Allow for room loading
This commit is contained in:
parent
21c15e5fae
commit
778daeb8ff
2 changed files with 8 additions and 6 deletions
|
@ -2,13 +2,15 @@
|
|||
import { useEffect } from 'react'
|
||||
import state from 'state'
|
||||
|
||||
export default function useLoadOnMount(roomId: string) {
|
||||
export default function useLoadOnMount(roomId?: string) {
|
||||
useEffect(() => {
|
||||
const fonts = (document as any).fonts
|
||||
|
||||
fonts.load('12px Verveine Regular', 'Fonts are loaded!').then(() => {
|
||||
state.send('MOUNTED')
|
||||
state.send('RT_LOADED_ROOM', { id: roomId })
|
||||
if (roomId !== undefined) {
|
||||
state.send('RT_LOADED_ROOM', { id: roomId })
|
||||
}
|
||||
})
|
||||
|
||||
return () => {
|
||||
|
|
|
@ -163,10 +163,10 @@ const state = createState({
|
|||
},
|
||||
on: {
|
||||
// Network-Related
|
||||
// RT_LOADED_ROOM: [
|
||||
// 'clearRoom',
|
||||
// { if: 'hasRoom', do: ['resetDocumentState', 'connectToRoom'] },
|
||||
// ],
|
||||
RT_LOADED_ROOM: [
|
||||
'clearRoom',
|
||||
{ if: 'hasRoom', do: ['resetDocumentState', 'connectToRoom'] },
|
||||
],
|
||||
// RT_UNLOADED_ROOM: ['clearRoom', 'resetDocumentState'],
|
||||
// RT_DISCONNECTED_ROOM: ['clearRoom', 'resetDocumentState'],
|
||||
// RT_CREATED_SHAPE: 'addRtShape',
|
||||
|
|
Loading…
Reference in a new issue