r3f fixes (#222)

* Minify r3f extension bundle, because it is expected by the React dead code elimination check, since we bundle React in it

* Add children to props, since it is required by React 18 types

* Fix getting context attributes for gl in ReferenceWindow

* Don't bundle threejs in extension

* Fix editor not responding to scene initialization

* Fix SnapshotEditor css
This commit is contained in:
Andrew Prifer 2022-06-18 02:59:45 +02:00 committed by GitHub
parent 16e255fd57
commit 262d7d61d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 44 deletions

View file

@ -1,3 +1,4 @@
import type {ReactNode} from 'react'
import React, {
createContext,
useContext,
@ -26,6 +27,7 @@ export const useCurrentSheet = (): ISheet | undefined => {
const SheetProvider: React.FC<{
sheet: ISheet
children: ReactNode
}> = ({sheet, children}) => {
const {scene, gl} = useThree((s) => ({scene: s.scene, gl: s.gl}))

View file

@ -52,7 +52,7 @@ export type EditorStore = {
) => void
}
const config: StateCreator<EditorStore> = (set) => {
const config: StateCreator<EditorStore> = (set, get) => {
return {
sheet: null,
editorObject: null,
@ -70,6 +70,10 @@ const config: StateCreator<EditorStore> = (set) => {
scene,
gl,
})
// Create a snapshot, so that if the editor is already open, it gets refreshed
// when the scene is initialized
get().createSnapshot()
},
addEditable: (uniqueName, editable) => {