fix(studio): declare Big Shoulders Display's bare style imports, and let a raced Studio save carry its revision

This commit is contained in:
Maurice
2026-10-23 19:33:11 +02:00
parent 72661196ee
commit 269fce0331
2 changed files with 13 additions and 1 deletions
+10
View File
@@ -3,3 +3,13 @@
/** The version this bundle was built as (client/package.json), set by `define` in vite.config.js. */
declare const __TREK_UI_VERSION__: string;
/**
* Big Shoulders Display's weights, imported for their stylesheets alone
* (components/Studio/bookFontFaces.ts). Its package maps `./*` to `./*.css`
* and has no `./*.css` entry, so the import names `100` rather than
* `100.css`, and vite/client's `*.css` declaration does not cover a bare
* name. Declared for this one package only, so a mistyped import of any
* other module still fails the check.
*/
declare module '@fontsource/big-shoulders-display/*';
@@ -561,9 +561,11 @@ describe('editBook', () => {
const journey = createJourney(testDb, user.id);
await books.saveBook(journey.id, user.id, { title: 'T', document: doc('one') });
// The Studio stamps its revision on every save, as the tool's write does, so the race is about the version alone.
const fromStudio = { ...doc('studio'), schemaRev: BOOK_SCHEMA_REV };
const [tool, studio] = await Promise.all([
catchDomainError(() => books.editBook(journey.id, user.id, edited('tool'), { expectedVersion: 1 })),
books.saveBook(journey.id, user.id, { title: 'T', document: doc('studio'), baseVersion: 1 }),
books.saveBook(journey.id, user.id, { title: 'T', document: fromStudio, baseVersion: 1 }),
]);
const toolLost = tool instanceof DomainError && tool.getStatus() === 409;