fix: useExisting - #51
Merged
Merged
Conversation
misaert
reviewed
Feb 10, 2026
| } | ||
|
|
||
| if ('object' === typeof itemOrIri && false === (options.force ?? false)) { | ||
| if ('object' === typeof itemOrIri && false === (options.force ?? false) && false !== (options.useExisting ?? true)) { |
Contributor
There was a problem hiding this comment.
See together, use a constant with the previous if to keep the same condition for useExisting. Like you say, it is better to use false !== (options.useExisting ?? true) to prevent wrong value other than boolean.
misaert
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related PR:
What's the problem:
getRelation in
src/hydra/hydra-plugin.jshave useExisting option. This option is meant to say "don't use cached data" if set to false — but it actually returns older data because it skips the store (which has fresh updates) and falls into the embedded object factory (which has stale data from the PATCH response).What's the solution:
The embedded object path should not be reached when useExisting: false — we should bypass existing data, not to use an even older source. So when useExisting: false and the input is an object, it should fall through to getItem which resolves by IRI. That's what this PR do !