-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Description
Description
Currently, the Apache Beam Playground loses all user progress (editor content and SDK selection) upon a page refresh. This creates significant friction for users who are experimenting with code or accidentally trigger a browser reload.
Proposed Change
I propose implementing a persistence layer using the browser's localStorage API to cache the following:
- Editor Content: The current string in the Monaco editor.
- Selected SDK: The active language (Java, Python, Go, SCIO).
- User-defined vs Example: Whether the user is viewing a standard example or their own custom code.
Technical Strategy
- State Hydration: Load state from
localStorageduring store initialization to prevent UI flickering. - Debounced Writes: Implement a 500ms-1000ms debounce for
localStorage.setItemcalls to ensure editor performance remains high. - Safety: Wrap JSON parsing in
try/catchblocks to prevent app crashes if local data is corrupted.
Impact
- DX Improvement: Users can return to their work even after closing the tab.
- Zero Backend Impact: This is a localized frontend change that requires no API modifications.
- Testability: The persistence logic can be verified via unit tests (Jest/Vitest).
I am willing to contribute
I have analyzed the playground/frontend directory and have a draft implementation ready using TypeScript.
Metadata
Metadata
Assignees
Labels
No labels