reload to check editable - #448
Open
SharonStrats wants to merge 2 commits into
Open
Conversation
…@5.0.0-1 pane-registry@5.0.0-0 chat-pane@4.0.0-0) (latest: rdflib@2.4.0)
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new priming path can crash or block updates (e.g., undefined fetcher and unhandled priming errors) and should be guarded and made best-effort before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a “reload-to-determine-editable” flow for RDF documents by extending shared RDF types and priming editable state during update transport.
Changes:
- Extend
RdfFetcher.loadtyping to accept load options, and add updater hooks (checkEditable,flagAuthorizationMetadata). - Add
primeEditableState()to re-check editability and (when needed) force-reload a document to refresh authorization/editable metadata. - Invoke
primeEditableState()fromrunUpdateTransport().
File summaries
| File | Description |
|---|---|
src/sections/shared/types.ts |
Adds DocumentLoadOptions and new optional updater/fetcher capabilities used by the editable-state priming flow. |
src/sections/shared/rdfMutationHelpers.ts |
Implements primeEditableState() and wires it into the update transport path to force reload when editability is initially unknown. |
Review details
- Files reviewed: 2/3 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+119
to
+126
| async function primeEditableState(store: LiveStore, doc: NamedNode, updater: RdfUpdater, fetcher: RdfFetcher): Promise<void> { | ||
| if (!authn.currentUser()) { | ||
| return | ||
| } | ||
|
|
||
| const { checkEditable, flagAuthorizationMetadata } = updater | ||
| const { load } = fetcher | ||
|
|
Comment on lines
+133
to
+141
| const docUri = doc.value | ||
| const initialEditable = await checkEditable(docUri, store) | ||
| if (initialEditable !== undefined || typeof load !== 'function') { | ||
| return | ||
| } | ||
|
|
||
| await load(doc, { force: true, clearPreviousData: true }) | ||
| await checkEditable(docUri, store) | ||
| } |
Comment on lines
+385
to
+389
| const fetcher = getStoreFetcher(store) | ||
|
|
||
| if (doc) { | ||
| await primeEditableState(store, doc, updater, fetcher) | ||
| } |
Comment on lines
+139
to
+141
| await load(doc, { force: true, clearPreviousData: true }) | ||
| await checkEditable(docUri, store) | ||
| } |
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.
Fix for this ticket SolidOS/solidos#349.