Skip to content

TT-7386 Assign section from sheet#360

Merged
gtryus merged 1 commit into
developfrom
TT-7386-sheet-assign-refresh
Jun 17, 2026
Merged

TT-7386 Assign section from sheet#360
gtryus merged 1 commit into
developfrom
TT-7386-sheet-assign-refresh

Conversation

@gtryus

@gtryus gtryus commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
  • Introduced a new test case to validate the assignment of passages based on organization scheme steps.
  • Updated the ScriptureTable component to refresh sections and organization scheme steps from the memory cache, ensuring the latest data is used when rendering the sheet.
  • Integrated a wait for remote queue in the AssignSection component to handle asynchronous operations more effectively.

@gtryus gtryus changed the title TT-7386 Add tests for passage assignee from organizationSchemeStep and improve sheet refresh logic TT-7386 Assign section from sheet Jun 16, 2026
@gtryus gtryus requested a review from Copilot June 16, 2026 16:32

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 correctness of “assign section from sheet” behavior by ensuring the sheet view is rebuilt from the most up-to-date Orbit Memory cache records and by better sequencing remote-side side effects when saving permission schemes.

Changes:

  • Added a unit test to validate that passage assignees are derived from organizationschemestep records tied to a section’s organizationScheme.
  • Updated ScriptureTable’s refreshSheet to re-query sections and organization scheme steps directly from memory.cache before calling getSheet.
  • Updated AssignSection to wait for the Orbit remote request queue to drain after saving a permission scheme and before running the assign call.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/renderer/src/components/Sheet/ScriptureTable.tsx Rebuilds the sheet using freshly queried sections and organization scheme steps from the Orbit Memory cache.
src/renderer/src/components/AssignSection.tsx Adds a remote-queue wait after saving scheme changes to reduce race conditions before assigning sections.
src/renderer/src/tests/getSheet.test.ts Adds coverage for selecting a passage assignee from an organization scheme step linked to the section’s scheme.

@gtryus gtryus requested a review from sarahentzel June 16, 2026 18:09
setBusy(true);
try {
const schemeId = await handleAdd();
await waitForRemoteQueue('permission scheme save');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

perhaps waitForRemoteId would be better here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have several tables to wait on. All the organiztionschemasteps, as well as the organizationschemes (which finishes first.) One of the last things to get updated is the sections table.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can completely leave out this change to AssignSection and the code still solves the issue. Normally Assign section is waiting until all the changes are written before it closes so we can simplify the PR by leaving this out.

) as SectionD[];
const freshSchemeSteps = memory.cache.query((q) =>
q.findRecords('organizationschemestep')
) as OrganizationSchemeStepD[];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we can't rely on useOrbitData we're in trouble. sections is in the callback refresh list. Why do we need to get from memory????? This feels like extra code that we shouldn't need.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

when I removed this code and just relied on what was there (a dependency which includes sections and and organizationshemestepss, the sheet isn't updated like it should be. :-(

@gtryus gtryus force-pushed the TT-7386-sheet-assign-refresh branch from 532b36e to 88f84e1 Compare June 16, 2026 20:23
@gtryus gtryus merged commit 01cdd44 into develop Jun 17, 2026
2 checks passed
@gtryus gtryus deleted the TT-7386-sheet-assign-refresh branch June 17, 2026 20:16
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.

3 participants