Skip to content

Commit 73a8ca3

Browse files
authored
fix: reenables the run on add ability (#3281)
1 parent 7bc0c35 commit 73a8ca3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/flows/context/flow.query.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,14 @@ export const FlowQueryProvider: FC = ({children}) => {
213213
}, [flow])
214214

215215
const generateMap = (): Stage[] => {
216-
if (
217-
!_map.current ||
218-
(!_map.current.length && (flow?.data?.allIDs ?? []).length)
219-
) {
216+
// this is to get around an issue where a panel is added, which triggers the useEffect that updates
217+
// _map.current and a rerender that updates the panel view components within the same render cycle
218+
// leading to a panel on the list without a corresponding map entry
219+
const forceUpdate =
220+
(flow?.data?.allIDs ?? []).join(' ') !==
221+
(_map.current ?? []).map(m => m.id).join(' ')
222+
223+
if (forceUpdate) {
220224
_generateMap()
221225
}
222226

0 commit comments

Comments
 (0)