Let the stars popups open from a built popup sandbox
Built with vite build (NODE_ENV=development, which keeps ?popups=1), six
stories threw: stars/balance, stars/topup, starReaction, payment/starsPay and
the two transaction/subscription ones. The dev server passed them all, and an
unminified build failed the same way, so it was not the minifier.
PaidMessagesInterceptor read the balance in a static field, rawStars =
useStars(), so loading the module fetched it over rootScope.managers. The
sandbox chunk imports the shared app chunk that holds the interceptor, and ESM
evaluates imported chunks before the importer's own body, so that ran before
bootstrapState, inside the sandbox chunk, had installed the mock managers.
Importing bootstrapState first orders modules only on the dev server. ?popups=1
now imports it on its own before the sandbox, and the interceptor reads the
balance when it needs it.
One early call broke every later one because useDynamicCachedValue kept the
failure. Outside a running update, createRoot reports a throwing factory
("solid error") and returns undefined, and that undefined stayed cached under
the key for the rest of the session. A failed factory is no longer cached, so
the next caller builds afresh, and its half-built root is disposed on the way
out. Inside a running update, where createRoot rethrows, that root used to be
left behind with whatever the factory had started.
Its keys were function names (_useStars.name, _useFullPeer.name,
usePeerTranslation.name), and minified names are unique only within a chunk:
EP, Yl and vu today, distinct only because the three share one. They are
string literals now.
Production is not affected: index.ts assigns the managers before its first
dynamic import, and the interceptor's chunk is not among the entry's static
imports. A signed-in production build reads the balance as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> E
Eduard Kuzmenko committed
08e0c3b34ac79ffa1ec18b39f67b4666f799c04a
Parent: d466ab7