Skip to content

TT-7631 Keep note category, title, and graphic in sync on the plan sheet TT-7634 Graphic Picker from library shows error on open - #533

Open
sarahentzel wants to merge 5 commits into
developfrom
TT-7631
Open

TT-7631 Keep note category, title, and graphic in sync on the plan sheet TT-7634 Graphic Picker from library shows error on open#533
sarahentzel wants to merge 5 commits into
developfrom
TT-7631

Conversation

@sarahentzel

Copy link
Copy Markdown
Collaborator

Persist NOTE|{category} on the passage when a note shared resource is created or updated, and refresh the sheet row (reference, graphic, title, pencil) without marking the grid dirty. Merge sheet rebuilds so a stale bare NOTE snapshot cannot wipe NOTE|{category}, but skip merge while a new row has no passage id so save-then-edit does not duplicate it. Note details load note categories on first paint; skip unusable graphic URLs and HTML library responses.

Persist NOTE|{category} on the passage when a note shared resource is created or updated,
and refresh the sheet row (reference, graphic, title, pencil) without marking the grid dirty.
Merge sheet rebuilds so a stale bare NOTE snapshot cannot wipe NOTE|{category}, but skip merge while a new row has no passage id so save-then-edit does not duplicate it.
Note details load note categories on first paint; skip unusable graphic URLs and HTML library responses.
@sarahentzel
sarahentzel marked this pull request as ready for review August 24, 2026 20:56
@sarahentzel sarahentzel changed the title TT-7631 Keep note category, title, and graphic in sync on the plan sheet TT-7631 Keep note category, title, and graphic in sync on the plan sheet TT-7634 Graphic Picker from library shows error on open Aug 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves note/shared-resource behavior in the renderer so that note category/title/graphic stay in sync on the plan sheet without marking the grid dirty, and hardens the graphic picker/library fetch flow against invalid/HTML responses and unusable graphic URLs.

Changes:

  • Persist NOTE|{category} in the underlying passage reference during shared-resource create/update, and refresh the active sheet row (reference/graphic/title/pencil) without flagging unsaved grid changes.
  • Improve sheet rebuild/merge behavior to avoid stale “bare NOTE” snapshots wiping categorized note references, and avoid merging while new rows lack a passage id.
  • Harden graphic/library UX by validating URL-building prerequisites, filtering unusable graphic URLs, and handling non-JSON/HTML library responses.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/renderer/src/crud/useSharedResUpdate.ts Updates passage reference on shared note updates and triggers sheet-row refresh callback.
src/renderer/src/crud/useSharedResCreate.ts Updates passage reference on shared note create and triggers sheet-row refresh callback.
src/renderer/src/crud/useGraphicUrlBuilder.ts Avoids building graphic API URLs when the base endpoint is missing.
src/renderer/src/crud/useGraphicFind.ts Improves category lookup robustness for NOTE references (localized vs slug).
src/renderer/src/components/Sheet/SelectArtifactCategory.tsx Adds cancellation handling while loading categories on first paint.
src/renderer/src/components/Sheet/ScriptureTable.tsx Refreshes sheet rows without marking dirty; adds merge gating and ownership checks for graphic rights/fullsize URLs.
src/renderer/src/components/Sheet/PlanSheet.tsx Ensures grid refill occurs when publishing/permission flags change.
src/renderer/src/components/Sheet/getSheet.ts Merges sheet rebuilds more safely to preserve categorized NOTE references and avoid incorrect graphic recomputation.
src/renderer/src/components/ResourceEdit/ResourceTabs.tsx Simplifies note detection and formatting for linked note read-only logic.
src/renderer/src/components/ResourceEdit/ResourceOverview.tsx Keeps dialog state note aligned with derived note-ness and consolidates effects.
src/renderer/src/components/ResourceEdit/ResourceCategory.tsx Fixes category type selection for notes vs resources and tightens imports.
src/renderer/src/components/ResourceEdit/ResourceCategory.test.tsx Adds unit test coverage for selecting note vs resource categories.
src/renderer/src/components/isUsableGraphicUrl.ts Adds a helper to reject incomplete/invalid S3 graphic keys while allowing data/blob URLs.
src/renderer/src/components/isUsableGraphicUrl.test.ts Adds unit tests for the usable-URL helper.
src/renderer/src/components/GraphicPicker.tsx Handles missing URLs and non-JSON/HTML responses from the library endpoint more gracefully.
src/renderer/src/components/apmGraphic.ts Filters unusable graphic URIs/URLs before returning them to callers.
src/renderer/src/tests/getSheet.test.ts Adds regression tests for NOTE merge behavior and correct graphic attachment during merges.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 44 to 62
if (sharedResource.attributes.note) {
const catRec = findRecord(memory, 'artifactcategory', category) as
| ArtifactCategory
| undefined;
if (catRec && onUpdRef) {
const catText = localizedArtifactCategory(
catRec.attributes?.categoryname
newRef = catRec
? `NOTE|${localizedArtifactCategory(catRec.attributes?.categoryname)}`
: 'NOTE';
if (passage && passage.attributes.reference !== newRef) {
ops.push(
...UpdateRecord(
t,
{
...passage,
attributes: { ...passage.attributes, reference: newRef },
},
user
)
);
const passage = sharedResource.relationships.passage
.data as RecordIdentity;
onUpdRef(passage.id, `NOTE|${catText}`, sharedResource);
}
Comment on lines 111 to 123
useEffect(() => {
let cancelled = false;
setGettingCategories(true);
getCategorys().then((cats) => {
if (cancelled) return;
setArtifactCategorys(cats);
setGettingCategories(false);
});
return () => {
cancelled = true;
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [artifactCategories, scripture, org, type]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants