[FRONTEND] Replace AppShell 100ms localStorage polling with event-based sidebar sync#715
[FRONTEND] Replace AppShell 100ms localStorage polling with event-based sidebar sync#715Pcmhacker-piro wants to merge 4 commits into
Conversation
…ecycle - Add workflow.spec.ts with mocked API routes for GET/POST/DELETE /workflows - Cover creation via CreateSheet, manual run with queued task display, and delete with grid removal confirmation - Include full lifecycle scenario combining create, run, and delete - Set up API key in localStorage before navigation to bypass auth gate Fixes utksh1#563
…sed sidebar sync - Remove 100ms polling interval from AppShell that was polling localStorage to detect sidebar state changes - Sidebar now dispatches a 'sidebar-state-changed' CustomEvent on window whenever isExpanded changes - AppShell listens for the CustomEvent instead of polling - Preserves localStorage persistence for cross-tab scenarios - No external dependencies or context providers needed
|
heyy @utksh1 |
utksh1
left a comment
There was a problem hiding this comment.
This needs changes before merge. The PR is stacked on the workflow E2E PR and includes unrelated test additions. More importantly, replacing the storage listener with only a custom event loses cross-tab localStorage synchronization. Please split/rebase this to only the sidebar sync change and keep both same-tab custom event handling and cross-tab storage handling covered.
- Keep storage event listener (browser-native cross-tab synchronization) - Keep CustomEvent listener (same-tab updates via Sidebar) - Remove 100ms setInterval polling (not needed) - Remove unrelated e2e workflow.spec.ts test additions
|
heyy @utksh1 |
utksh1
left a comment
There was a problem hiding this comment.
Re-reviewed the latest update. This is closer, but still not merge-ready.
The diff still appears stacked with unrelated workflow E2E history, and the AppShell formatting is visibly off after the change. Please rebase/split so only AppShell/Sidebar sidebar sync changes remain, fix formatting, and add focused tests for both same-tab custom-event sync and cross-tab storage sync.
✦ Description
Replaced the 100ms
setIntervalpolling loop inAppShellthat was continuously readinglocalStorageto detect sidebar expansion state changes. Instead, theSidebarcomponent now dispatches asidebar-state-changedCustomEvent whenever its expanded state changes, andAppShelllistens for this event.Changes Made
sidebar-state-changedCustomEvent onwindowwheneverisExpandedchanges (alongside the existinglocalStoragewrite for cross-tab persistence).setIntervalpolling loopstorageevent listener (only works across tabs, not same-tab)sidebar-state-changedCustomEvent for same-tab synchronizationWhy
The previous approach used a
setIntervalthat ran every 100ms to polllocalStorage, which is wasteful and brittle. The new approach uses explicit event-based communication that only fires when the state actually changes.Fixes #553
⟡ Type of Change
✦ Checklist