korbit-ai[bot] commented on code in PR #31979:
URL: https://github.com/apache/superset/pull/31979#discussion_r1932424213


##########
superset-frontend/src/dashboard/components/SyncDashboardState/index.tsx:
##########
@@ -66,10 +67,13 @@ const selectDashboardContextForExplore = createSelector(
     (state: RootState) => state.dataMask,
   ],
   (metadata, dashboardId, colorScheme, filters, dataMask) => {
-    const nativeFilters = Object.keys(filters).reduce((acc, key) => {
-      acc[key] = pick(filters[key], ['chartsInScope']);
-      return acc;
-    }, {});
+    const nativeFilters = Object.keys(filters).reduce(
+      (acc, key) => {
+        acc[key] = pick(filters[key], ['chartsInScope']);
+        return acc;
+      },
+      {} as Record<string, Pick<Filter | Divider, 'chartsInScope'>>,
+    );

Review Comment:
   Hi @hainenber, thank you for your reply. You're correct that the assigned 
value has the type `Pick<Filter | Divider, 'chartsInScope'>`. I see the 
potential for misinterpretation, as the `Filter` objects surely have the 
'chartsInScope' field but the `Divider` objects do not. For the sake of clarity 
and to prevent any runtime issues, would it be possible to add some error 
handling or validation to ensure that the `Divider` type is not being used in a 
context where 'chartsInScope' is accessed? This would make the code more 
resilient to errors caused by type mismatches.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to