Re-get the openPanes from localStorage when navigating between projects (#3241)
* Re-get the openPanes from localStorage when navigating between projects * fmt
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import { useMachine } from '@xstate/react'
|
import { useMachine } from '@xstate/react'
|
||||||
import React, { createContext, useEffect, useRef } from 'react'
|
import React, { createContext, useEffect, useMemo, useRef } from 'react'
|
||||||
import {
|
import {
|
||||||
AnyStateMachine,
|
AnyStateMachine,
|
||||||
ContextFrom,
|
ContextFrom,
|
||||||
@ -8,7 +8,12 @@ import {
|
|||||||
StateFrom,
|
StateFrom,
|
||||||
assign,
|
assign,
|
||||||
} from 'xstate'
|
} from 'xstate'
|
||||||
import { SetSelections, modelingMachine } from 'machines/modelingMachine'
|
import {
|
||||||
|
SetSelections,
|
||||||
|
getPersistedContext,
|
||||||
|
modelingMachine,
|
||||||
|
modelingMachineDefaultContext,
|
||||||
|
} from 'machines/modelingMachine'
|
||||||
import { useSetupEngineManager } from 'hooks/useSetupEngineManager'
|
import { useSetupEngineManager } from 'hooks/useSetupEngineManager'
|
||||||
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
||||||
import {
|
import {
|
||||||
@ -99,6 +104,7 @@ export const ModelingMachineProvider = ({
|
|||||||
} = useSettingsAuthContext()
|
} = useSettingsAuthContext()
|
||||||
const token = auth?.context?.token
|
const token = auth?.context?.token
|
||||||
const streamRef = useRef<HTMLDivElement>(null)
|
const streamRef = useRef<HTMLDivElement>(null)
|
||||||
|
const persistedContext = useMemo(() => getPersistedContext(), [])
|
||||||
|
|
||||||
let [searchParams] = useSearchParams()
|
let [searchParams] = useSearchParams()
|
||||||
const pool = searchParams.get('pool')
|
const pool = searchParams.get('pool')
|
||||||
@ -121,6 +127,13 @@ export const ModelingMachineProvider = ({
|
|||||||
const [modelingState, modelingSend, modelingActor] = useMachine(
|
const [modelingState, modelingSend, modelingActor] = useMachine(
|
||||||
modelingMachine,
|
modelingMachine,
|
||||||
{
|
{
|
||||||
|
context: {
|
||||||
|
...modelingMachineDefaultContext,
|
||||||
|
store: {
|
||||||
|
...modelingMachineDefaultContext.store,
|
||||||
|
...persistedContext,
|
||||||
|
},
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
'disable copilot': () => {
|
'disable copilot': () => {
|
||||||
editorManager.setCopilotEnabled(false)
|
editorManager.setCopilotEnabled(false)
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user