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

(graphcache) - should not store undefined values in storage #865

Closed
wants to merge 2 commits into from

Conversation

JoviDeCroock
Copy link
Collaborator

@JoviDeCroock JoviDeCroock commented Jun 14, 2020

Summary

Should not store undefined values since these aren't valid in GraphQL

Fixes: #864
Sandbox: https://codesandbox.io/s/urql-svelte-crud-with-indexeddb-cqg5i?file=/package.json

Set of changes

  • exclude translation from undefined to null in storage

@changeset-bot
Copy link

changeset-bot bot commented Jun 14, 2020

🦋 Changeset is good to go

Latest commit: 2abab2b

We got this.

This PR includes changesets to release 1 package
Name Type
@urql/exchange-graphcache Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@JoviDeCroock JoviDeCroock marked this pull request as draft June 14, 2020 16:00
@JoviDeCroock JoviDeCroock requested a review from kitten June 14, 2020 16:06
@JoviDeCroock JoviDeCroock marked this pull request as ready for review June 14, 2020 16:06
@frederikhors
Copy link
Contributor

I tried with codesandbox package. It works!

Can you release it please?

data += `${stringifyVariables(key)}:${
value !== undefined ? stringifyVariables(value) : 'null'
},`;
if (batch[key] !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

This isn’t quite right I believe, because we do need to ensure that this deletes / overrides old values.
So we may want to specially encode undefined

@JoviDeCroock JoviDeCroock deleted the fix-undefined-storage branch June 14, 2020 18:12
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.

With makeDefaultStorage and offlineExchange: error: "Cannot read property '0' of null"
3 participants