Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
refetch scenes after new scene on toolbar (#10520)
Browse files Browse the repository at this point in the history
Co-authored-by: Rahul Ghosh <[email protected]>
Co-authored-by: Josh Field <[email protected]>
  • Loading branch information
3 people authored Jul 7, 2024
1 parent 450a525 commit 63d4261
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Ethereal Engine. All Rights Reserved.
*/

import { PopoverState } from '@etherealengine/client-core/src/common/services/PopoverState'
import { StaticResourceType, staticResourcePath } from '@etherealengine/common/src/schema.type.module'
import { StaticResourceType, fileBrowserPath, staticResourcePath } from '@etherealengine/common/src/schema.type.module'
import { useClickOutside } from '@etherealengine/common/src/utils/useClickOutside'
import { deleteScene, onNewScene } from '@etherealengine/editor/src/functions/sceneFunctions'
import { EditorState } from '@etherealengine/editor/src/services/EditorServices'
import { getMutableState, useHookstate, useMutableState } from '@etherealengine/hyperflux'
import { useFind } from '@etherealengine/spatial/src/common/functions/FeathersHooks'
import { useFind, useRealtime } from '@etherealengine/spatial/src/common/functions/FeathersHooks'
import React, { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { HiDotsHorizontal } from 'react-icons/hi'
Expand All @@ -56,18 +56,18 @@ export default function ScenesPanel() {
getMutableState(EditorState).scenePath.set(scene.key)
}

useRealtime(fileBrowserPath, scenesQuery.refetch)

const isCreatingScene = useHookstate(false)
const handleCreateScene = async () => {
isCreatingScene.set(true)
await onNewScene()
scenesQuery.refetch()
isCreatingScene.set(false)
}

const deleteSelectedScene = async (scene: StaticResourceType) => {
if (scene) {
await deleteScene(scene.key)
scenesQuery.refetch()
if (editorState.sceneAssetID.value === scene.id) {
editorState.sceneName.set(null)
editorState.sceneAssetID.set(null)
Expand Down

0 comments on commit 63d4261

Please sign in to comment.