fix(desktop): restore profile/agent switching in release builds (nanostores 1.4.2)

nanostores 1.4.0-1.4.1 annotate batch() @__NO_SIDE_EFFECTS__. Rollup
(via vite build) honors that and erases a result-unused batch(...) call
as dead code -- callback included. Since d57f94a33/053eb7aab/4e520f085
moved the gateway-switch publication (activate() +
+ ) inside batch(), packaged desktop builds lost the entire
publication: clicking a profile in the rail did nothing at all.

Dev builds and vitest run unminified, so only the packaged app broke.

nanostores 1.4.2 removes the annotation from batch() (it stays on the
creation functions, where it is correct). Bump all three pinned copies
(apps/desktop, apps/bootstrap-installer, ui-tui) and add a regression
test asserting the installed nanostores never re-annotates batch.
This commit is contained in:
royzhrxy-glitch
2026-08-19 11:30:20 +08:00
committed by Teknium
parent ceabb030fb
commit a787bfeab9
5 changed files with 40 additions and 9 deletions
+1 -1
View File
@@ -32,7 +32,7 @@
"clsx": "2.1.1",
"katex": "0.16.47",
"lucide-react": "0.577.0",
"nanostores": "1.4.0",
"nanostores": "1.4.2",
"radix-ui": "1.6.7",
"react": "19.2.7",
"react-dom": "19.2.7",
+1 -1
View File
@@ -130,7 +130,7 @@
"katex": "0.16.47",
"mermaid": "11.16.1",
"motion": "12.42.2",
"nanostores": "1.4.0",
"nanostores": "1.4.2",
"node-pty": "1.1.0",
"radix-ui": "1.6.7",
"react": "19.2.7",
@@ -0,0 +1,31 @@
/**
* Regression guard: the desktop's gateway-switch publication runs inside
* nanostores' batch(). nanostores 1.4.0–1.4.1 annotated batch() with
* `/* @__NO_SIDE_EFFECTS__ *\/`, which let production bundlers (Rollup, via
* `vite build`) erase result-unused batch(...) calls — callback included —
* deleting the entire publication from release builds and freezing
* profile/agent switching there. Dev builds and vitest run unminified, so
* only the packaged app broke. nanostores 1.4.2 removed the annotation;
* this test fails if the installed version ever carries it again.
*/
import { readFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import path from 'node:path'
import { describe, expect, it } from 'vitest'
const require = createRequire(import.meta.url)
describe('nanostores batch()', () => {
it('is not annotated @__NO_SIDE_EFFECTS__ — bundlers would erase its calls', () => {
const nanostoresEntry = require.resolve('nanostores')
const atomSource = readFileSync(path.join(path.dirname(nanostoresEntry), 'atom/index.js'), 'utf8')
// Capture any block comment immediately preceding the batch export.
const match = atomSource.match(/(\/\*(?:[^*]|\*(?!\/))*\*\/\s*)?export const batch\b/)
expect(match, 'nanostores atom/index.js should export const batch').toBeTruthy()
expect(match![1] ?? '').not.toContain('__NO_SIDE_EFFECTS')
expect(match![1] ?? '').not.toContain('__PURE__')
})
})
+6 -6
View File
@@ -46,7 +46,7 @@
"clsx": "2.1.1",
"katex": "0.16.47",
"lucide-react": "0.577.0",
"nanostores": "1.4.0",
"nanostores": "1.4.2",
"radix-ui": "1.6.7",
"react": "19.2.7",
"react-dom": "19.2.7",
@@ -116,7 +116,7 @@
"katex": "0.16.47",
"mermaid": "11.16.1",
"motion": "12.42.2",
"nanostores": "1.4.0",
"nanostores": "1.4.2",
"node-pty": "1.1.0",
"radix-ui": "1.6.7",
"react": "19.2.7",
@@ -14527,9 +14527,9 @@
}
},
"node_modules/nanostores": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/nanostores/-/nanostores-1.4.0.tgz",
"integrity": "sha512-i0tloweeudshAEuddpDxcg9Ik6pkPfVsHIgKyf143JrgG7/MOh0+q7BypdLXZPoOP7fOYt1eTcwGkyiVmhJFkA==",
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/nanostores/-/nanostores-1.4.2.tgz",
"integrity": "sha512-Wxv8Roefr2nqtiRG0bnaFlpYqpIVtOEeJZHaH+4nGgOK1/7n6OHOuHCb/bhqrNQgZM8fyd0s1PqhdrJc9Ib44g==",
"funding": [
{
"type": "github",
@@ -19127,7 +19127,7 @@
"@hermes/shared": "file:../apps/shared",
"@nanostores/react": "1.1.0",
"ink-text-input": "6.0.0",
"nanostores": "1.4.0",
"nanostores": "1.4.2",
"react": "19.2.7",
"undici": "6.28.0",
"unicode-animations": "1.0.3"
+1 -1
View File
@@ -23,7 +23,7 @@
"@hermes/shared": "file:../apps/shared",
"@nanostores/react": "1.1.0",
"ink-text-input": "6.0.0",
"nanostores": "1.4.0",
"nanostores": "1.4.2",
"react": "19.2.7",
"undici": "6.28.0",
"unicode-animations": "1.0.3"