zhaoyongjie commented on a change in pull request #17680:
URL: https://github.com/apache/superset/pull/17680#discussion_r770222334



##########
File path: 
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx
##########
@@ -187,28 +193,45 @@ const FilterBar: React.FC<FiltersBarProps> = ({
   );
 
   const publishDataMask = useCallback(
-    (dataMaskSelected: DataMaskStateWithId) => {
+    async (dataMaskSelected: DataMaskStateWithId) => {
       const { location } = history;
       const { search } = location;
       const previousParams = new URLSearchParams(search);
       const newParams = new URLSearchParams();
-
+      let dataMaskKey = '';
       previousParams.forEach((value, key) => {
         if (key !== URL_PARAMS.nativeFilters.name) {
           newParams.append(key, value);
         }
       });
 
-      newParams.set(
-        URL_PARAMS.nativeFilters.name,
-        rison.encode(replaceUndefinedByNull(dataMaskSelected)),
+      const nativeFiltersCacheKey = getUrlParam(
+        URL_PARAMS.nativeFiltersByCacheKey,
       );
+      const dataMask = JSON.stringify(dataMaskSelected);
+      if (
+        updateKey &&
+        nativeFiltersCacheKey &&
+        (await updateFilterKey(dashboardId, dataMask, nativeFiltersCacheKey))
+      ) {
+        dataMaskKey = nativeFiltersCacheKey;
+      } else {
+        let filterType;
+        const isOldRison = getUrlParam(URL_PARAMS.nativeFilters);
+        if (typeof isOldRison === 'object') {
+          filterType = rison.encode(isOldRison);
+        } else filterType = dataMask;
+
+        dataMaskKey = await createFilterKey(dashboardId, filterType);
+        console.log('dataMask', dataMaskKey);

Review comment:
       remove console




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to