sveltejs / sveltejs/devalue

Why can't symbolic keys be stringified?

Open
#76 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.8k
Forks
99
Avg merge
3d 7h
Merged PRs (30d)
17

Description

Hi,
I'm using SvelteKit together with Prisma with computed fields. Results cannot be stringified and sent to the client (in load for example), because that throws this error:

Cannot stringify POJOs with symbolic keys

Interestingly, if I just comment out those checks here and here, it works just fine. Is there a reason for this check and some edge cases I haven't yet ran into?

Thanks in advance.

For anyone wanting to test, here's a patchfile for yarn patch: devalue-npm-4.3.2-e483100d94.patch

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the symbolic-key checks in src/stringify.js at lines 144-149 and src/uneval.js at lines 92-97, then reproduce the SvelteKit and Prisma computed-fields case described in the issue. Determine why the checks exist and document or test the edge cases involved; done means the behavior and any safe supported outcome are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.