Skip to content

fix(web): the desktop app no longer fails to start with "twMerge is not a function" - #14

Merged
greaber merged 1 commit into
grant/mainfrom
grant/fix-twmerge-cycle
Nov 15, 2026
Merged

greaber merged 1 commit into
grant/mainfrom
grant/fix-twmerge-cycle

Conversation

@greaber

@greaber greaber commented Nov 15, 2026

Copy link
Copy Markdown
Owner

The fork's desktop app (0.1.9-grant.3) showed "T3 Code failed to start. TypeError: Wot is not a function" at startup. Wot is twMerge in apps/web/src/lib/utils.ts (from the bundle's source map).

Cause: #7 (7d54248fa0) made composerDraftStore import components/ui/toast, which imports lib/utils, which imported DraftId from composerDraftStore. In that cycle cn() can run before lib/utils has defined twMerge. Upstream's composerDraftStore has no toast import, so upstream is unaffected. The same cycle is why the web browser tests failed to load on grant/main with "Cannot access 'twMerge' before initialization".

Fix: DraftId moves to apps/web/src/draftId.ts; composerDraftStore re-exports it, so its importers are unchanged, and lib/utils imports the new module.

Check SHA Result
vp test run Sidebar.logic.browser, ChatView.logic.browser, ChatView.browser, ChatView.modelPick.browser (apps/web) 0056710 4 files, 11 tests passed
Same browser tests without the change 2368d71 fail to load: "Cannot access 'twMerge' before initialization"
vp test run src/composerDraftStore.test.ts src/lib/utils.test.ts 0056710 81 passed
vp run typecheck (apps/web) 0056710 pass
vp run check:changed 0056710 format, lint, knip, typecheck, react compiler pass; unused patches failed on a pnpm peer-dependency warning in infra/relay (unrelated); test (109 files) hit the 900 s limit

🤖 Generated with Claude Code

…ot a function"

#7 made composerDraftStore import the toast module, which imports lib/utils,
which imported DraftId from composerDraftStore. In the desktop build that
cycle ran cn() before lib/utils had defined twMerge, so the window showed
"T3 Code failed to start. TypeError: … is not a function"; the browser tests
failed to load with "Cannot access 'twMerge' before initialization".

DraftId moves to its own module; composerDraftStore re-exports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greaber
greaber merged commit 9fbd54f into grant/main Nov 15, 2026
4 of 5 checks passed
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant