bito-code-review[bot] commented on code in PR #43085:
URL: https://github.com/apache/superset/pull/43085#discussion_r3764869728
##########
superset-frontend/src/dashboard/containers/DashboardPage.tsx:
##########
@@ -83,6 +83,30 @@ type NativeFilterConfigEntry = Partial<Filter> & { id:
string };
export const DashboardPageIdContext = createContext('');
+const DASHBOARD_FILTERS_STORAGE_PREFIX = 'superset_dashboard_filters_';
+
+function getSavedDashboardFilters(dashboardId: number) {
+ try {
+ const raw = localStorage.getItem(
+ `${DASHBOARD_FILTERS_STORAGE_PREFIX}${dashboardId}`,
+ );
+ return raw ? JSON.parse(raw) : null;
+ } catch {
+ return null; // localStorage disabled, quota exceeded, corrupt JSON, etc.
+ }
+}
+
+function saveDashboardFilters(dashboardId: number, dataMask: unknown) {
+ try {
+ localStorage.setItem(
+ `${DASHBOARD_FILTERS_STORAGE_PREFIX}${dashboardId}`,
+ JSON.stringify(dataMask),
+ );
+ } catch {
+ // fail silently — persistence is a nice-to-have, not critical path
+ }
+}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing unit test coverage</b></div>
<div id="fix">
New localStorage persistence functions lack unit tests per BITO.md adaptive
rule [6262]. Tests should verify: (1) JSON parse error returns null, (2)
localStorage disabled returns null, (3) correct key prefix construction, (4)
successful save roundtrip.
</div>
</div>
<small><i>Code Review Run #732b46</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]