digidem / digidem/comapeo-core-react

Occasional error from React Query about structural sharing

Open
#71 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1
Forks
1
Avg merge
5m
Merged PRs (30d)
2

Description

Example message:

Structural sharing requires data to be JSON serializable. 

To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [["@comapeo/core-react","projects","rjncq9zpqhfu1jstk44xo4qtfc3j9kuri9der8b77qtfco3tkomy"]]: 

Error: ReferenceError: Symbol(Symbol.toStringTag) is not defined

This is coming from the usage of useSingleProject() which returns a "project client", which is a proxy instance that is created via https://github.com/digidem/rpc-reflector/.

I think it's ideal to have structural sharing enabled (docs), which allows React Query to keep the reference the same between re-renders, but maybe there's a detail I'm not understanding that allows us to disable it.

If possible, this probably would be better off with a fix in rpc-reflector as oppose to something here.

Contributor guide

Open the contributing guide

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 with the useSingleProject() usage in this repository and trace how its project client reaches React Query structural sharing. Then inspect the proxy behavior in rpc-reflector and the linked React Query structural-sharing documentation. Done means the intermittent serialization error is resolved while the intended structural-sharing behavior is preserved or its required configuration is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.