omsn2 commented on code in PR #43108:
URL: https://github.com/apache/superset/pull/43108#discussion_r3888664382
##########
superset-frontend/src/dashboard/containers/DashboardPage.tsx:
##########
@@ -226,6 +268,17 @@ export const DashboardPage: FC<PageProps> = ({ idOrSlug }:
PageProps) => {
}
} else if (nativeFilterKeyValue) {
dataMask = await getFilterValue(id, nativeFilterKeyValue);
+ } else {
+ const savedFilters = getSavedDashboardFilters(id, userId);
+ // Guard against corrupted or unexpected localStorage data shapes
+ // (e.g. a JSON array or primitive) before assigning to dataMask.
+ if (
+ savedFilters &&
+ typeof savedFilters === 'object' &&
+ !Array.isArray(savedFilters)
+ ) {
+ dataMask = savedFilters;
Review Comment:
Currently, the check validates that the stored filter ID still actively
exists in the dashboard's native_filter_configuration (which effectively
catches filter deletions and complete replacements). Adding deep versioning
(e.g., by hashing filter targets and storing that alongside the dataMask in
localStorage) would require a change to the client-side storage schema for
native filters. Since this PR already greatly improves the baseline persistence
safety (by scoping to userId and validating IDs), I'd prefer to handle deeper
schema-based invalidation in a separate follow-up PR to keep this one focused.
--
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]