-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(cache): add peekRemoteState to cache to view remote state #9624
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
Changes from all commits
dbea098
ce1a1cd
b7594c2
5f3c6a4
62debce
a4be97d
3025c84
ca3a0bc
0979baf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,16 +40,19 @@ export function createResourceEdge(definition: UpgradedMeta, identifier: StableR | |
}; | ||
} | ||
|
||
export function legacyGetResourceRelationshipData(source: ResourceEdge): ResourceRelationship { | ||
export function legacyGetResourceRelationshipData(source: ResourceEdge, getRemoteState: boolean): ResourceRelationship { | ||
source.accessed = true; | ||
let data: StableRecordIdentifier | null | undefined; | ||
const payload: ResourceRelationship = {}; | ||
if (source.localState) { | ||
if (getRemoteState && source.remoteState) { | ||
data = source.remoteState; | ||
} else if (!getRemoteState && source.localState) { | ||
data = source.localState; | ||
} | ||
if (source.localState === null && source.state.hasReceivedData) { | ||
if (((getRemoteState && source.remoteState === null) || source.localState === null) && source.state.hasReceivedData) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @richgt in my testing (on 4.13, backported from 5.3), this line seems incorrect in the situation where a relationship was non-null, but is set to null locally and not yet saved. I think the line should be:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assuming:
for
for
I believe the mistake here is actually that the check on line 52 is an |
||
data = null; | ||
} | ||
|
||
if (source.links) { | ||
payload.links = source.links; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love that this means we dont flush the computation unless needed <3