fix(editor): stop autosave refetch from deselecting node mid-edit#509
Merged
Conversation
The pipeline editor hydrated the flow store whenever pipelineQuery.data changed, guarded only by (hasLoadedRef && isDirty). Auto-save's onSuccess both calls markClean() (isDirty=false) and invalidates pipeline.get, so the refetch re-ran loadGraph, which resets selectedNodeId to null and kicked the user out of the detail/edit panel every 2 seconds. Hydrate the store once per mount instead. A remount still re-hydrates from fresh data; while mounted the store is the source of truth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Editing a pipeline component's config kicked the user out of the detail/edit panel every ~2 seconds. Symptom: components keep "refreshing off" the edit section.
Root cause
Auto-save invalidation loop:
isDirty = truesaveGraph(editor-client.tsx:449)onSuccess→markClean()setsisDirty = false(flow-store.ts:1094) and invalidatespipeline.get(editor-client.tsx:292)pipelineQuery.dataref → hydration effect rerunsif (hasLoadedRef.current && isDirty) return;fails becauseisDirtyis nowfalse→loadGraph()runs againloadGraphresetsselectedNodeId: null(flow-store.ts:1169) → detail panel deselects the nodeServer data was identical to the store, so the reload was pointless and destroyed the selection. The clean-state reload guard backfired: save makes the store clean, then the refetch reloads.
Fix
Hydrate the store once per mount. Refetches no longer re-run
loadGraph. A remount (navigate away/back) resetshasLoadedRefand re-hydrates from fresh data; while mounted the store remains the source of truth.Test plan
Follow-up (not in this PR)
detail-panel.tsx:418runs a duplicatepipeline.getquery (same key as parent), causing extra refetches/flicker on invalidate. Consider passing pipeline data down as a prop.