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
|
||||
const { party } = useSnapshot(appState)
|
||||
const jobState = party.job
|
||||
|
||||
const [job, setJob] = useState<Job>()
|
||||
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
|
||||
useEffect(() => {
|
||||
const resetState = clonedeep(initialAppState)
|
||||
appState.grid = resetState.grid
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
setJob(jobState)
|
||||
}, [jobState])
|
||||
|
||||
useEffect(() => {
|
||||
jobChanged()
|
||||
}, [job])
|
||||
|
|
|
|||
Loading…
Reference in a new issue