@supernova-studio/client 0.47.64 → 0.47.66

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": "@supernova-studio/client",
3
- "version": "0.47.64",
3
+ "version": "0.47.66",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -126,10 +126,6 @@ export class FrontendVersionRoomYDoc {
126
126
  const result = new Map<string, DTODocumentationDraftState>();
127
127
 
128
128
  pages.forEach(page => {
129
- // Current state
130
- const currentPageContentHash = pageHashes[page.persistentId] ?? "";
131
- const currentState: ItemState = this.itemStateFromPage(page, currentPageContentHash);
132
-
133
129
  // Published state
134
130
  const snapshot = publishedSnapshotsByPageId.get(page.id);
135
131
  let publishedState: ItemState | undefined;
@@ -138,6 +134,10 @@ export class FrontendVersionRoomYDoc {
138
134
  publishedState = this.itemStateFromPage(publishedPage, snapshot.pageContentHash);
139
135
  }
140
136
 
137
+ // Current state - if content hash is undefined, it means that the page hasn't changed
138
+ const currentPageContentHash = pageHashes[page.persistentId] ?? snapshot?.pageContentHash ?? "";
139
+ const currentState: ItemState = this.itemStateFromPage(page, currentPageContentHash);
140
+
141
141
  // Calculate draft
142
142
  const draftState = this.createDraftState(page.persistentId, currentState, publishedState);
143
143
  if (draftState) result.set(page.id, draftState);
@@ -248,7 +248,7 @@ export class FrontendVersionRoomYDoc {
248
248
  updatedDraftState.changes.previousContentHash = publishedState.contentHash;
249
249
  }
250
250
 
251
- if (Object.keys(updatedDraftState).length) {
251
+ if (Object.keys(updatedDraftState.changes).length) {
252
252
  // Item has at least one of the draft changes
253
253
  return updatedDraftState;
254
254
  }