Skip to content

Commit

Permalink
Clean up references
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Feb 29, 2024
1 parent e0bc8fa commit 345ca6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
7 changes: 1 addition & 6 deletions app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,12 @@ export default function App () {
/**
* Setup a reference to hold
* the current value of the
* states in order to access it from
* state in order to access it from
* within the apply functions
* @type { React.Ref }
*/
const sharedRef = React.useRef({})
const localRef = React.useRef({})

React.useEffect(() => {
sharedRef.current = shared
}, [shared])

React.useEffect(() => {
localRef.current = local
}, [local])
Expand Down
12 changes: 3 additions & 9 deletions plugins/inspector/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ export default function App () {
const [store, setStore] = React.useState()
const [state, setState] = React.useState()

const storeRef = React.useRef()

React.useEffect(() => {
storeRef.current = store
}, [store])

/*
Fetch the state directly
on context load
Expand Down Expand Up @@ -52,11 +46,11 @@ export default function App () {
.map(id => bridge.items.getLocalItem(id))
.filter(item => item)

setStore({
...storeRef.current,
setStore(current => ({
...current,
selection,
items
})
}))
}, [selection, state])

return (
Expand Down

0 comments on commit 345ca6c

Please sign in to comment.