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

Cannot return data from the SQLite cache if the query has "." #1071

Closed
evanzhou89 opened this issue Mar 8, 2020 · 6 comments · Fixed by #2057
Closed

Cannot return data from the SQLite cache if the query has "." #1071

evanzhou89 opened this issue Mar 8, 2020 · 6 comments · Fixed by #2057
Labels
apollo-sql Issue with the SQL sub-project bug Generally incorrect behavior caching

Comments

@evanzhou89
Copy link

evanzhou89 commented Mar 8, 2020

For example here is the query:

QUERY_ROOT.repository(name:apollo-ios,owner:apollographql).object(expression:master:Package.swift)

Apollo-ios version: 0.23.1

@designatednerd
Copy link
Contributor

This is likely related to #991, which was working around a bug around periods in cache key names.

@giantramen any thoughts on this?

@giantramen
Copy link

No easy fix here like there was for my issue, “.” is used to split the query path so there’s no way to tell your “.” shouldn’t be used to split as is.
Any way you could strip the “.swift” on your end?

@designatednerd
Copy link
Contributor

Woof, that's going to be somewhere between a pain in the ass and impossible because of the way that QUERY_ROOT cache key is generated. Using the cacheKeyForObject won't really help much in terms of preventing refetches, because that's used more for notifiying watchers of a changed result.

This is definitely a bug. The long-term solution is probably to use something other than . as the cache key separator on our end when I update our cache as part of Phase 2 of the Swift Codegen project.

@designatednerd designatednerd added apollo-sql Issue with the SQL sub-project bug Generally incorrect behavior labels Mar 9, 2020
@ppowers10
Copy link

I did this a while ago to avoid the issue: #329 (comment)

Not sure if it is the best, but it worked in our forked version of Apollo. Essentially, as the cacheKey is created, we replaced all of the . with a -.

Long term, we spoke to our backend and updated our params to not include a . to get around this issue.

@kyum1n
Copy link

kyum1n commented Jul 15, 2020

Is there any update on this case? We seem to run into this aswell because we send params like app version or access tokens which can contain a .. Getting rid of all dots on the backend side is not feasable for us. For now we have to use a fork with the previously mentioned workaround from #329. It works so far but I'm not sure I fully understand the scope of that workaround and if it brings its own problems.

@designatednerd
Copy link
Contributor

Nope, not yet, this phase is still a ways out, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-sql Issue with the SQL sub-project bug Generally incorrect behavior caching
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants