Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refetch scenes after new scene on toolbar #10520

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already calling useRealtime in FeathersChildReactor for each feathers request. Why do we need to do it again here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's causing a referch for a different query


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
Loading