File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export const Submit: FC = () => {
1919 const { cancel} = useContext ( QueryContext )
2020 const { generateMap, queryAll, status} = useContext ( FlowQueryContext )
2121
22- const hasQueries = generateMap ( ) . filter ( s => ! ! s . source ) . length > 0
22+ const hasQueries = generateMap ( true ) . filter ( s => ! ! s . source ) . length > 0
2323
2424 const handleSubmit = ( ) => {
2525 event ( 'Notebook Submit Button Clicked' )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export interface Stage {
2525}
2626
2727export interface FlowQueryContextType {
28- generateMap : ( ) => Stage [ ]
28+ generateMap : ( doubleForceUpdate ?: boolean ) => Stage [ ]
2929 printMap : ( id ?: string ) => void
3030 query : ( text : string , override ?: QueryScope ) => Promise < FluxResult >
3131 basic : ( text : string , override ?: QueryScope ) => any
@@ -177,15 +177,16 @@ export const FlowQueryProvider: FC = ({children}) => {
177177 _generateMap ( )
178178 } , [ flow ] )
179179
180- const generateMap = ( ) : Stage [ ] => {
180+ const generateMap = ( doubleForceUpdate ?: boolean ) : Stage [ ] => {
181181 // this is to get around an issue where a panel is added, which triggers the useEffect that updates
182182 // _map.current and a rerender that updates the panel view components within the same render cycle
183183 // leading to a panel on the list without a corresponding map entry
184184 const forceUpdate =
185185 ( flow ?. data ?. allIDs ?? [ ] ) . join ( ' ' ) !==
186186 ( _map . current ?? [ ] ) . map ( m => m . id ) . join ( ' ' )
187187
188- if ( forceUpdate ) {
188+ if ( forceUpdate || doubleForceUpdate ) {
189+ // doubleForceUpdate is used to resolve react life cycle issue
189190 _generateMap ( )
190191 }
191192
You can’t perform that action at this time.
0 commit comments