-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Which project does this relate to?
Start
Describe the bug
The bug is caused by using a class' name as a key for a serialization
adapter instead of a literal string. In this example, see src/IntWrapper.ts,
where the serialization adapter is registered using IntWrapper.name.
The initial suspicion was that the name property could change after bundle
time since the class could be minified or mangled, but after testing by simply
logging the value of IntWrapper.name in various environments (dev, prod)
it consistently printed IntWrapper. This indicates that the class name remains stable
across different builds in this specific case (which is surprising to me).
Using this as a key:
{
key: (() => {
console.log(IntWrapper.name);
return IntWrapper.name;
})(),
}yields the error in prod build even though it does log IntWrapper. You would expect
that using the class name as a key would work if it is stable, but apparently
it does not.
Your Example Website or App
https://github.com/notKamui/tss-serialization-adapter-seroval-error
Steps to Reproduce the Bug or Issue
- Install the dependencies (preferably using bun to use the present bun.lock, but any should work)
- Build (
bun run build) - Start the prod server (uses srvx) (
bun run start) - Go to
http://localhost:3000 - Click on the "Go to Sum" link (goes to /sum)
- See the error happen (logs on the client and server)
- Reload the page at
http://localhost:3000/sumto see a different error on the client
Expected behavior
No error should happen, and the serialization should be correct
Screenshots or Videos
Platform
- Router / Start Version: 1.141.2
- OS: Any (tested on macOS, Windows)
- Browser: Arc (Chromium)
- Browser Version: Chromium Engine Version 141.0.7390.55
- Bundler: Vite
- Bundler Version: 7.3.0
Additional context
No response