-
Notifications
You must be signed in to change notification settings - Fork 7
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
add options to load() to resolve recursiveDelete() issue #12
base: main
Are you sure you want to change the base?
Conversation
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.
LGTM
src/index.ts
Outdated
return this.store.fetcher.load(doc) | ||
// force = true to reload the doc | ||
// but first remove doc: this is to avoid just adding quads | ||
if (options && options.force) this.store.removeDocument(doc as NamedNode) |
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'm quite new to Typescript so may have misunderstood but if someone passed a NamedNode array or a string to load() will it work to pass that to removeDocument as a NamedNode?
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.
Yes it will work if you don't use force = true. If you use force = true
doc must be a Named node.
I took this solution because it was used elsewhere in the code, it was simple, it was compatible with the used cases and offer a plus possibility to load().
In an other way there is no regression
If you don't use force = true then load can receive NamedNode, NamedNode Array or String like before.
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.
@edwardsph I made the changes. I don't know anything in typescript. My initial idea was wrong. Load now can pass a NamedNode, NamedNode Array or a string to load() and pass that to removeDocument() as namedNode.
Tested locally with all 3 types.
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.
LGTM
"his.store.fetcher.load(doc) with no options reuse the existing document in store. |
If you want to reload something already loaded you have There is also fetcher.unload. Do not use store.removeDocument as it will leave the cache metadata wrong. |
@timbl Thanks.
The proposed patch do not change the actual use of x.load() in solid-ui Shall there be possibility to
|
Finally modified only getContainerMembers(). Recursive delete must be sure to act on the latest situation and not from a cache that may not be up to date. |
@bourgeoa is this still accurate? Shall we merge it? |
For me it was good to merge. |
Because this PR was hard to merge due to the refactoring of code, I created a new PR with just the prominent changes of this PR: https://github.com/solid/solid-logic/tree/loadImprovement @bourgeoa please check it and close and merge these PRs if ok. |
this.store.fetcher.load(doc) with no options reuse the existing document in store.
This is not what we expect. We want load a new document.
options.force = true reload the document but adds new triples
we neee to remove the document from store in that case
force = true is used in aclDocUrl() and getContainerMembers().
@michielbdejong Should it be a default for load() ?
solid spec implies that delete is atomic (delete ressource and auxiliary one in the same operation)
I remove the acl delete in recursiveDelete()