clockworklabs / clockworklabs/SpacetimeDB
TypeScript SDK - Bug: If project sources are minified, the wrong table/reducer class name is registered
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
The issue is that the registerTables and registerReducers methods rely on the .name attribute of the generated classes in the bindings. I'd recommend to use .tableName (I'm not sure though if that suitable) or add a separate static field .className instead of relying on JavaScript sources that may change during bundling and minification.
Ib my case, I'm configuring the Spacetime SDK in a Next.js project which has code minification enabled, and the class names in the bindings are mangled which causes missing class error:
Uncaught (in promise) Could not find class "World", you need to register it with SpacetimeDBClient.registerTable() first
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TypeScript SDK entry points named registerTables and registerReducers, then inspect how generated binding classes provide their names. Reproduce the issue with a minified Next.js build and confirm that table and reducer registration no longer depends on mangled JavaScript class names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100