diff --git a/websocket/change.ts b/websocket/change.ts index 875be66..b9c5cf9 100644 --- a/websocket/change.ts +++ b/websocket/change.ts @@ -10,7 +10,8 @@ export type Change = | FilesChange | HelpFeelsChange | infoboxDefinitionChange - | TitleChange; + | TitleChange + | PinChange; export interface InsertChange { _insert: string; lines: { diff --git a/websocket/pin.ts b/websocket/pin.ts index 9f47dbe..65ae575 100644 --- a/websocket/pin.ts +++ b/websocket/pin.ts @@ -45,7 +45,6 @@ export const pin = ( page.pin > 0 || (!page.persistent && !(options?.create ?? false)) ) return []; // Create page and pin it in a single operation - // @ts-ignore The server is expected to accept combined creation and pin operations const changes: Change[] = [{ pin: pinNumber() }]; if (!page.persistent) changes.unshift({ title }); return changes; diff --git a/websocket/push.ts b/websocket/push.ts index 5aa68de..a9176bd 100644 --- a/websocket/push.ts +++ b/websocket/push.ts @@ -1,4 +1,4 @@ -import type { Change, DeletePageChange, PinChange } from "./change.ts"; +import type { Change, DeletePageChange } from "./change.ts"; import type { PageCommit } from "./emit-events.ts"; import { connect, disconnect } from "./socket.ts"; import type { Socket } from "socket.io-client"; @@ -125,13 +125,12 @@ export type PushError = export type CommitMakeHandler = ( page: PushMetadata, attempts: number, - prev: Change[] | [DeletePageChange] | [PinChange], + prev: Change[] | [DeletePageChange], reason?: "NotFastForwardError" | "DuplicateTitleError", ) => - | Promise + | Promise | Change[] - | [DeletePageChange] - | [PinChange]; + | [DeletePageChange]; /** Push changes to a specific page using WebSocket * @@ -174,7 +173,7 @@ export const push = async ( try { let attempts = 0; - let changes: Change[] | [DeletePageChange] | [PinChange] = []; + let changes: Change[] | [DeletePageChange] = []; let reason: "NotFastForwardError" | "DuplicateTitleError" | undefined; // Outer loop: handles diff creation and conflict resolution