Skip to content

Commit

Permalink
fix: preload feature request
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Dec 20, 2024
1 parent c1a4bdc commit 9dfcb4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/presentation/src/PresentationTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
EDIT_INTENT_MODE,
LIVE_DRAFT_EVENTS_ENABLED,
} from './constants'
import PostMessageFeatures from './features/PostMessageFeatures'
import {useUnique, useWorkspace, type CommentIntentGetter} from './internals'
import {debounce} from './lib/debounce'
import {SharedStateProvider} from './overlays/SharedStateProvider'
Expand Down Expand Up @@ -74,7 +75,6 @@ import {useStatus} from './useStatus'
const LoaderQueries = lazy(() => import('./loader/LoaderQueries'))
const LiveQueries = lazy(() => import('./loader/LiveQueries'))
const PostMessageDocuments = lazy(() => import('./overlays/PostMessageDocuments'))
const PostMessageFeatures = lazy(() => import('./features/PostMessageFeatures'))
const PostMessageRefreshMutations = lazy(() => import('./editor/PostMessageRefreshMutations'))
const PostMessagePerspective = lazy(() => import('./PostMessagePerspective'))
const PostMessagePreviewSnapshots = lazy(() => import('./editor/PostMessagePreviewSnapshots'))
Expand Down
12 changes: 3 additions & 9 deletions packages/visual-editing/src/ui/useDatasetMutator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ export function useDatasetMutator(
setMutator(mutator)
mutator.start()

return () => {
mutator.stop()
setMutator(undefined)
}
}, [comlink])

useEffect(() => {
if (!comlink || !mutator) return
// Fetch features to determine if optimistic updates are supported
const featuresFetch = new AbortController()
const unsub = comlink.onStatus(() => {
Expand All @@ -56,10 +48,12 @@ export function useDatasetMutator(
}, 'connected')

return () => {
mutator.stop()
featuresFetch.abort()
unsub()
setMutator(undefined)
}
}, [mutator, comlink])
}, [comlink])

return mutator
}

0 comments on commit 9dfcb4c

Please sign in to comment.