-
Notifications
You must be signed in to change notification settings - Fork 82
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
How to avoid re-fetching objects after syncing changes? #327
Comments
I would do something like your first option. If If you are keeping track of state strings on a per-object rather than per-type basis (I don't, because you don't really need to in general) you could skip invalidating it if the object's state string matches the Does that make sense? |
The context here is in a webapp where you have cached the objects in IndexedDB. If the user clicks on a link to an object that is not cached (e.g.
Even if I have per-objet state tracking it's not possible to detect this today in the example I gave. The |
Yes, this sounds fine. It depends on the application of course, but for most it should be fine to fetch the object and use the cached data while you do the rest of the sync in the background.
Sorry, I must not have been clear. I'm saying the common case is likely to be the object from the /get was Example.
|
Then it seems like I've understood how JMAP works today. I have some ideas for a slightly modified |
Sure, always happy to hear more ideas. Generally, there's a trade-off in terms of extra state data having to be transferred with every request in order to potentially save some data in certain resync cases later. Whether that's worth it will depend on the use case to a certain extent, but we've tried to pick a broadly applicable model for the base JMAP standard. |
Here's a scenario I've been wondering about:
state=s1
for an object type.o1
). The response includesstate=s5
./changes
withsinceState=s1
to get all of the changes. The response returnsoldState=s1, newState=s7
ando1
is marked as created.We know that
o1
was created between s1 and s7, and we already have the object at state s5, but we don't know if the object has changed between s5 and s7.What's the recommended way of dealing with this?
Some alternatives I've been thinking about:
/changes
returns we invalidate it if thenewState
from/changes
doesn't match up with thestate
from/get
. The idea is that it's unlikely for the state to change between the response from the/get
until you invoke/changes
. This will however always invalidate the object if the server decides to use the fancy "serve newest changes first" as thennewState
will always be a different state./changes
for both s1 and s5, and then subtract one from the other. This has the disadvantage that they might contain a lot of duplicate data, and that subtraction might not even be possible in a single call if they returnhasMoreChanges
.Thoughts? Am I overcomplicating this issue?
The text was updated successfully, but these errors were encountered: