fix(sockets): add sockets event for tag / env var dropdown selections#844
fix(sockets): add sockets event for tag / env var dropdown selections#844icecrasher321 merged 7 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Greptile Summary
This PR introduces a socket-based approach for handling tag dropdown and environment variable selections to solve race conditions caused by the debounced operation system. The change adds a new useTagSelection hook that immediately updates the local store and emits a dedicated tag-selection socket event, bypassing the normal debounced workflow operations that were causing user selections to be overwritten.
The implementation spans multiple components across the codebase:
- New hook:
useTagSelectionprovides a callback that performs dual operations - immediate local store updates for instant UI feedback and socket emission for server persistence - Component updates: Seven UI components (code.tsx, long-input.tsx, short-input.tsx, combobox.tsx, document-tag-entry.tsx) replace
setStoreValuecalls withemitTagSelectioncalls in their dropdown selection handlers - Socket infrastructure: The socket context adds the new
emitTagSelectionmethod, and a new server handler processestag-selectionevents with immediate database persistence and client broadcasting
The change specifically targets dropdown selection scenarios where users expect immediate feedback and persistence, distinguishing these from regular text input that can safely use debounced operations. This ensures that rapid dropdown interactions followed by page refreshes don't result in data loss, which was the core issue being addressed.
Confidence score: 3/5
- This PR addresses a legitimate user experience issue but introduces significant technical debt through code duplication
- Score reflects concerns about the server-side handler duplicating most of the existing
subblock-updatelogic without operation tracking mechanisms - Pay close attention to the socket handler implementation in
subblocks.tswhich lacks proper error handling and creates a parallel event system
8 files reviewed, 6 comments
...nts/workflow-block/components/sub-block/components/document-tag-entry/document-tag-entry.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…#844) * fix(sockets): add sockets event for tag / env var dropdown selections to be unit op * do not bypass op queue for tag selections * Update apps/sim/socket-server/handlers/subblocks.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * prevent race cond between subblock update event and tag selection * refactor * reduce debounce time to 50ms --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…simstudioai#844) * fix(sockets): add sockets event for tag / env var dropdown selections to be unit op * do not bypass op queue for tag selections * Update apps/sim/socket-server/handlers/subblocks.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * prevent race cond between subblock update event and tag selection * refactor * reduce debounce time to 50ms --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Summary
Tag dropdown / Env Var selections were going through debounce system and were getting overwritten occasionally. Making it a atomic op by adding socket event.
Type of Change
Testing
Pick out variables from tag dropdown / environment variable selection drop downs and refresh quickly -- should always persist.
Checklist