refactor: eliminate local state mirroring, use TanStack Query as single source of truth#265
Merged
chubes4 merged 1 commit intoExtra-Chill:mainfrom Feb 17, 2026
Conversation
…le source of truth (Extra-Chill#263) - PipelineContextFiles: replace manual fetch/state with useContextFiles, useUploadContextFile, useDeleteContextFile TanStack hooks - InlineStepConfig: derive initial values via useMemo instead of useEffect, create useUpdateFlowStepConfig mutation for saves instead of raw API call - FlowScheduleModal: replace manual intervals fetch with useSchedulingIntervals query hook (added to config.js) - FlowStepCard: pass pipelineId/flowId to InlineStepConfig for cache invalidation - Add useUpdateFlowStepConfig mutation to queries/flows.js - Add useSchedulingIntervals query to queries/config.js
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.
Summary
Eliminates local state mirroring patterns that bypass TanStack Query's cache, addressing the root cause of race conditions like #262 (blank fields on initial load).
Closes #263
Changes
PipelineContextFiles.jsx
files,loading,error,uploading,deleting) and theloadFilesfetch-in-useEffect patternuseContextFiles(pipelineId),useUploadContextFile(), anduseDeleteContextFile()— TanStack hooks that already existed but were unusedInlineStepConfig.jsx
useEffect-based initialization oflocalValueswithuseMemoto derive initial values fromhandlerConfigprop + field schemaupdateFlowStepConfig()API call with newuseUpdateFlowStepConfigmutation that properly invalidates flow query cache on successFlowScheduleModal.jsx
intervalsfetch-in-useEffect +useAsyncOperationwith newuseSchedulingIntervals()TanStack query hookstaleTime: Infinitysince they don't change at runtimeNew hooks
useUpdateFlowStepConfiginqueries/flows.js— mutation for flow step config updates with cache invalidationuseSchedulingIntervalsinqueries/config.js— query for scheduling interval optionsFlowStepCard.jsx
pipelineIdandflowIdtoInlineStepConfigfor proper cache invalidationNot changed (lower priority)
Testing