Skip to content

Commit 60099f4

Browse files
kermanxprk3
andauthored
fix: drawings should appear after build (#1665)
Co-authored-by: prk3 <kukulski.przemyslaw@gmail.com>
1 parent e48a287 commit 60099f4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/client/composables/useDrawings.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { computed, markRaw, nextTick, reactive, ref, watch } from 'vue'
22
import type { Brush, Options as DrauuOptions, DrawingMode } from 'drauu'
33
import { createDrauu } from 'drauu'
44
import { createSharedComposable, toReactive, useLocalStorage } from '@vueuse/core'
5-
import { drawingState, onPatch, patch } from '../state/drawings'
5+
import { drawingState, onPatchDrawingState, patchDrawingState } from '../state/drawings'
66
import { configs } from '../env'
77
import { isInputting } from '../state'
88
import { useNav } from './useNav'
@@ -67,7 +67,7 @@ export const useDrawings = createSharedComposable(() => {
6767
function clearDrauu() {
6868
drauu.clear()
6969
if (syncUp.value)
70-
patch(currentSlideNo.value, '')
70+
patchDrawingState(currentSlideNo.value, '')
7171
}
7272

7373
function updateState() {
@@ -93,11 +93,11 @@ export const useDrawings = createSharedComposable(() => {
9393
const dump = drauu.dump()
9494
const key = currentSlideNo.value
9595
if ((drawingState[key] || '') !== dump && syncUp.value)
96-
patch(key, drauu.dump())
96+
patchDrawingState(key, drauu.dump())
9797
}
9898
})
9999

100-
onPatch((state) => {
100+
onPatchDrawingState((state) => {
101101
disableDump = true
102102
if (state[currentSlideNo.value] != null)
103103
drauu.load(state[currentSlideNo.value] || '')

packages/client/state/drawings.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@ import { createSyncState } from './syncState'
33

44
export type DrawingsState = Record<number, string | undefined>
55

6-
const { init, onPatch, patch, state } = createSyncState<DrawingsState>(serverDrawingState, {}, __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
7-
export { init as initDrawingState, onPatch, patch, state as drawingState }
6+
export const {
7+
init: initDrawingState,
8+
onPatch: onPatchDrawingState,
9+
patch: patchDrawingState,
10+
state: drawingState,
11+
} = createSyncState<DrawingsState>(serverDrawingState, serverDrawingState, __SLIDEV_FEATURE_DRAWINGS_PERSIST__)

0 commit comments

Comments
 (0)