[BUG] @geajs/ssr: store serialization fails on symbol-keyed items; select value binding crashes linkedom shim
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
Two independent issues break `renderToString` for form-heavy apps:
#### 1. Store serialization fails with `DevalueError: Cannot stringify POJOs with symbolic keys`
The keyed-list runtime stamps bookkeeping symbols directly onto raw store items (`Symbol.for('gea.d.dirty')`, and a `Symbol('gea.itemKey')`-keyed Set on parents) via the reactive proxy `set` trap. After rendering, `serializeStores()` walks the live proxied store tree with devalue's `uneval()`, which refuses POJOs that have symbolic own properties:
```
[gea-ssr] Render error: DevalueError: Cannot stringify POJOs with symbolic keys
at walk (devalue/src/uneval.js:122)
at serializeStores (@geajs/ssr/dist/chunk-KDLSDZE2.js:441)
path: '.cvStore.data.education[0]'
```
Any SSR app whose rendered output includes a keyed `.map()` over store arrays hits this on every request.
Suggested fix: sanitize symbol-keyed own properties (deep clone keeping only string keys / values devalue supports) before calling `uneval()` in `serializeStores`.
#### 2. `` crashes under the linkedom shim
`@geajs/ssr` uses linkedom as its DOM shim, but linkedom's `HTMLSelectElement` declares `value` as a **getter-only** property. The compiler emits `el.value = ...` writes for value bindings, which throw in strict mode:
```
TypeError: Cannot set property value of [object Object] which has only a getter
```
Repro: render any component containing `` during SSR.
Suggested fix: in `installDom()`, define a `value` setter on the shimmed select prototype that updates the matching option's `selected` flag (linkedom's `HTMLOptionElement.selected` setter already handles deselecting siblings).
### Affected versions
`@geajs/ssr@1.0.4`, `@geajs/core@1.4.0`, `@geajs/vite-plugin@1.4.1`
### Workarounds we applied locally
- Sanitize symbol keys before `uneval()` in `serializeStores`
- Patch linkedom's `HTMLSelectElement.prototype.value` with a setter before rendering
Happy to send PRs for both if you'd like.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in @geajs/ssr at serializeStores and installDom, then trace their use during renderToString. Reproduce both cases with a keyed store array and a select value binding. Done means SSR completes without either error, symbol-keyed bookkeeping is absent from serialized stores, and the select value binding updates the matching option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100