Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully fix issue sending data from client to devtools #1268

Merged
merged 7 commits into from
Mar 12, 2024

Conversation

jerelmiller
Copy link
Member

Fully reverts changes from #1245 that removed JSON.stringify from the entire client payload. Irregular cache values caused some issues when serializing on all fields.

@jerelmiller jerelmiller requested a review from a team as a code owner March 12, 2024 16:01
Copy link

relativeci bot commented Mar 12, 2024

Job #8: Bundle Size — 1.08MiB (~-0.01%).

42eef38(current) vs 66c05ae main#3(baseline)

Warning

Bundle contains 5 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Improvement 1 improvement
                 Current
Job #8
     Baseline
Job #3
Improvement  Initial JS 1.04MiB(~-0.01%) 1.04MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 94.56% 0%
No change  Chunks 5 5
No change  Assets 12 12
No change  Modules 486 486
No change  Duplicate Modules 32 32
No change  Duplicate Code 7.42% 7.42%
No change  Packages 59 59
No change  Duplicate Packages 4 4
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
Job #8
     Baseline
Job #3
Improvement  JS 1.04MiB (~-0.01%) 1.04MiB
Not changed  IMG 35.85KiB 35.85KiB
Not changed  HTML 810B 810B
Not changed  Other 777B 777B

View job #8 reportView json-stringify-all-data branch activityView project dashboard

@jerelmiller
Copy link
Member Author

Noting here that @phryneas had a good idea to JSON.parse(JSON.stringify(...)) in the content script before sending it. This should guarantee the value is serializable.

@jerelmiller jerelmiller force-pushed the json-stringify-all-data branch from 1147da9 to 92fb43e Compare March 12, 2024 16:08
@jerelmiller jerelmiller changed the title Json stringify all data Fully fix issue sending data from client to devtools Mar 12, 2024
// sent without errors.
//
// https://github.com/apollographql/apollo-client-devtools/issues/1258
payload: JSON.parse(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll note here that I think a potential future improvement here is to catch errors in case the cache can't be fully stringified. It would be a much nicer experience to show an error in the devtools panel, but we'll need to figure out a way to transport that error over. That is a bit out of scope for this PR.

Copy link
Member

@phryneas phryneas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in Chrome, TypeScript compiles, looks good, let's go! :)

@jerelmiller jerelmiller merged commit 4c98879 into main Mar 12, 2024
9 checks passed
@jerelmiller jerelmiller deleted the json-stringify-all-data branch March 12, 2024 16:47
@github-actions github-actions bot mentioned this pull request Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants