Fix memory leak
This commit is contained in:
parent
eb8e8ab4cf
commit
47f41a19a0
1 changed files with 5 additions and 5 deletions
|
|
@ -39,21 +39,21 @@ const Party = (props: Props) => {
|
||||||
|
|
||||||
// Set up states
|
// Set up states
|
||||||
const { party } = useSnapshot(appState)
|
const { party } = useSnapshot(appState)
|
||||||
|
const jobState = party.job
|
||||||
|
|
||||||
const [job, setJob] = useState<Job>()
|
const [job, setJob] = useState<Job>()
|
||||||
const [currentTab, setCurrentTab] = useState<GridType>(GridType.Weapon)
|
const [currentTab, setCurrentTab] = useState<GridType>(GridType.Weapon)
|
||||||
|
|
||||||
// Update job when state changes
|
|
||||||
subscribeKey(appState.party, 'job', (value: Job) => {
|
|
||||||
setJob(value)
|
|
||||||
})
|
|
||||||
|
|
||||||
// Reset state on first load
|
// Reset state on first load
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const resetState = clonedeep(initialAppState)
|
const resetState = clonedeep(initialAppState)
|
||||||
appState.grid = resetState.grid
|
appState.grid = resetState.grid
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setJob(jobState)
|
||||||
|
}, [jobState])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
jobChanged()
|
jobChanged()
|
||||||
}, [job])
|
}, [job])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue