Compare commits

..
3 Commits
Author SHA1 Message Date
SirBlob 2cabc3e303 Harden Typst wasm parser fallback against panics
CI / frontend (push) Successful in 20s
CI / backend (push) Successful in 1m27s
2026-07-22 18:07:19 -04:00
SirBlob 0e69f5a179 Guard conflict choice lookup before it is populated 2026-07-22 18:07:19 -04:00
SirBlob 7b0cc2a807 Fix incorrect y-websocket event name in sync wait 2026-07-22 18:07:19 -04:00
3 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -110,7 +110,7 @@
: 'border-[var(--color-line)] text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-muted)]'}" : 'border-[var(--color-line)] text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-muted)]'}"
onclick={() => (index = position)} onclick={() => (index = position)}
> >
{#if choices[position].includes("<<<<<<<")} {#if choices[position]?.includes("<<<<<<<")}
<Icon icon="ph:warning" class="text-[var(--color-danger)]" /> <Icon icon="ph:warning" class="text-[var(--color-danger)]" />
{:else} {:else}
<Icon icon="ph:check-circle" class="text-[var(--color-success)]" /> <Icon icon="ph:check-circle" class="text-[var(--color-success)]" />
+16
View File
@@ -70,6 +70,12 @@
const isToml = $derived(filePath.toLowerCase().endsWith(".toml")); const isToml = $derived(filePath.toLowerCase().endsWith(".toml"));
function disableTypstLanguage() {
queueMicrotask(() => {
view?.dispatch({ effects: languageSlot.reconfigure([]) });
});
}
function resilientSync(parser: any) { function resilientSync(parser: any) {
return StateField.define<null>({ return StateField.define<null>({
create: () => null, create: () => null,
@@ -78,7 +84,11 @@
transaction.startState.facet(language) !== transaction.startState.facet(language) !==
transaction.state.facet(language) transaction.state.facet(language)
) { ) {
try {
parser.clearParser(); parser.clearParser();
} catch {
disableTypstLanguage();
}
return null; return null;
} }
@@ -94,7 +104,13 @@
for (const edit of edits.edits) parser.applyTreeEdit(edit); for (const edit of edits.edits) parser.applyTreeEdit(edit);
}); });
} catch { } catch {
try {
parser.clearParser(); parser.clearParser();
} catch {
// The wasm parser instance panicked and is no longer usable.
// Drop syntax highlighting rather than crash on every keystroke.
disableTypstLanguage();
}
} }
return null; return null;
+1 -1
View File
@@ -688,7 +688,7 @@ async function tryOpenCollab(file: string, diskContent: string) {
); );
const synced = await new Promise<boolean>((resolve) => { const synced = await new Promise<boolean>((resolve) => {
session.provider.once("synced", (isSynced: boolean) => resolve(isSynced)); session.provider.once("sync", (isSynced: boolean) => resolve(isSynced));
}).catch(() => false); }).catch(() => false);
if (app.activePath !== file) { if (app.activePath !== file) {