mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
add state updaet
This commit is contained in:
parent
a008e95b8f
commit
b19619c2d2
@ -23,6 +23,7 @@ export const multitabEditorLogic = kea<multitabEditorLogicType>([
|
||||
props({} as MultitabEditorLogicProps),
|
||||
actions({
|
||||
setQueryInput: (queryInput: string) => ({ queryInput }),
|
||||
updateState: true,
|
||||
runQuery: (queryOverride?: string) => ({ queryOverride }),
|
||||
setActiveQuery: (query: string) => ({ query }),
|
||||
setTabs: (tabs: Uri[]) => ({ tabs }),
|
||||
@ -178,6 +179,22 @@ export const multitabEditorLogic = kea<multitabEditorLogicType>([
|
||||
}
|
||||
}
|
||||
},
|
||||
setQueryInput: () => {
|
||||
actions.updateState()
|
||||
},
|
||||
updateState: async (_, breakpoint) => {
|
||||
await breakpoint(100)
|
||||
const queries = values.allTabs.map((model) => {
|
||||
return {
|
||||
query: props.monaco?.editor.getModel(model)?.getValue() || {
|
||||
kind: NodeKind.HogQLQuery,
|
||||
query: '',
|
||||
},
|
||||
path: model.path.split('/').pop(),
|
||||
}
|
||||
})
|
||||
localStorage.setItem(editorModelsStateKey(props.key), JSON.stringify(queries))
|
||||
},
|
||||
runQuery: ({ queryOverride }) => {
|
||||
actions.setActiveQuery(queryOverride || values.queryInput)
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user