Rename IdeToolbarNew to IdeWrapper

related to #360
This commit is contained in:
Kurt Hutten
2021-06-12 20:57:04 +10:00
parent f032dd1e90
commit e591eb8ff8
5 changed files with 3 additions and 3 deletions

View File

@@ -0,0 +1,23 @@
import { makeCodeStoreKey } from 'src/helpers/hooks/useIdeState'
import { requestRender } from 'src/helpers/hooks/useIdeState'
import { useContext } from 'react'
import { IdeContext } from 'src/pages/DevIdePage/DevIdePage'
export const useRender = () => {
const { state, thunkDispatch } = useContext(IdeContext)
return () => {
thunkDispatch((dispatch, getState) => {
const state = getState()
dispatch({ type: 'setLoading' })
requestRender({
state,
dispatch,
code: state.code,
viewerSize: state.viewerSize,
camera: state.camera,
})
})
localStorage.setItem(makeCodeStoreKey(state.ideType), state.code)
}
}