@slidev/client 0.40.1 → 0.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.40.1",
3
+ "version": "0.40.2",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "vue-router": "^4.1.6",
41
41
  "vue-starport": "^0.3.0",
42
42
  "windicss": "^3.5.6",
43
- "@slidev/parser": "0.40.1",
44
- "@slidev/types": "0.40.1"
43
+ "@slidev/parser": "0.40.2",
44
+ "@slidev/types": "0.40.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "vite": "^4.1.1"
package/setup/root.ts CHANGED
@@ -54,7 +54,7 @@ export default function setupRoot() {
54
54
  const routePath = router.currentRoute.value.path
55
55
  if (!routePath.match(/^\/(\d+|presenter)\/?/))
56
56
  return
57
- if (+state.page !== +currentPage.value || clicks.value !== state.clicks) {
57
+ if (+state.page !== +currentPage.value || +clicks.value !== +state.clicks) {
58
58
  router.replace({
59
59
  path: getPath(state.page),
60
60
  query: {
@@ -16,6 +16,8 @@ export function createSyncState<State extends object>(serverState: State, defaul
16
16
  }
17
17
 
18
18
  function patch<K extends keyof State>(key: K, value: State[K]) {
19
+ if (state[key] === value)
20
+ return
19
21
  clearTimeout(patchingTimeout)
20
22
  patching = true
21
23
  state[key] = value
@@ -46,7 +48,7 @@ export function createSyncState<State extends object>(serverState: State, defaul
46
48
  })
47
49
  }
48
50
 
49
- function onDrawingStateChanged() {
51
+ function onStateChanged() {
50
52
  if (!persist && stateChannel && !updating)
51
53
  stateChannel.postMessage(toRaw(state))
52
54
  else if (persist && !updating)
@@ -55,7 +57,7 @@ export function createSyncState<State extends object>(serverState: State, defaul
55
57
  onPatchCallbacks.forEach((fn: (state: State) => void) => fn(state))
56
58
  }
57
59
 
58
- watch(state, onDrawingStateChanged, { deep: true })
60
+ watch(state, onStateChanged, { deep: true })
59
61
  if (!__USE_SERVER__ && persist) {
60
62
  const serialzedState = window.localStorage.getItem(channelKey)
61
63
  if (serialzedState)