Skip to content

Update in Canvas moves an item to its file's module - #21

Merged
teichert merged 6 commits into
SnowSE:mainfrom
teichert:fix/update-moves-module
Oct 12, 2026
Merged

teichert merged 6 commits into
SnowSE:mainfrom
teichert:fix/update-moves-module

Conversation

@teichert

@teichert teichert commented Oct 11, 2026 •

Copy link
Copy Markdown

Summary

Moving a file to another module folder and clicking Update in Canvas left the item in its old Canvas module: create put items in a module, update never looked.

  • canvasModuleService.placeInModule finds the item's module items with module_item_sequence (works for assignments, quizzes and pages; checked read-only against a real course). It makes the file's module the only one holding the item: keeps or moves (PUT …/items/:id with module_id) one copy into it, adds one if the item is in no module, and deletes any other copies.
  • usePlaceInCanvasModule looks the module up by folder name (loading the module list first, so a missing module isn't created twice) and toasts when it moved, added or removed something.
  • The assignment, quiz and page update hooks call it; their 8 callers pass moduleName (pages also pass their Canvas url, for the add case).
  • Add to Canvas now uses the same lookup (useCanvasModuleIdByName, one addModuleItem), which removes three copies of find-or-create-module. Adding a quiz or page before the module list had loaded used to do nothing.
  • The editor footer, Compare with Canvas and the calendar compare the file's module folder with the Canvas modules that hold the item (useCanvasModuleNames, one request for the course's modules with their items). Modules are compared as a set: a moved file, or an item also in another Canvas module, is a difference, so Update in Canvas is the footer's main button. getStatus.tsx was a pass-through to getSyncStatus and is gone.
  • Guide: the Publishing bullet and a Recent changes row.

Test plan

  • vitest (401), tsc, eslint (0 errors); service tests for already / moved / added / extra copies removed and for pages; sync-report tests for the module row
  • Move a quiz's file to another module, Update in Canvas: it moves in Canvas, with a toast
  • Update an item that hasn't moved: no module change, no toast
  • Against real Canvas: the calendar after the module comparison (how many items newly differ), a page's compare view (Module row), Add to Canvas then In sync

🤖 Generated with Claude Code

teichert and others added 6 commits October 10, 2026 23:51
Creating an item put it in the module named after its folder, but
updating never looked at modules, so moving a file to another module
changed nothing in Canvas. After updating an assignment, quiz or page,
Update in Canvas now finds the item's module items (module_item_sequence)
and moves one into the right module, or adds it when it is in none. The
module list is loaded first so a missing module isn't created twice.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…dule

# Conflicts:
#	docs/getting-started.html
One addModuleItem replaces createModuleItem and createPageModuleItem, and
useCanvasModuleIdByName replaces the find-or-create copied into each add
hook. Adding a quiz or page before the module list loaded used to do
nothing; now it loads the list first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The editor footer, compare page and calendar compare the file's module
folder with the Canvas modules that hold the item (one request for the
course's modules with their items), so a moved file is a difference
instead of In sync. Add to Canvas refreshes that list, so a new item
doesn't show as in no module. getStatus was a pass-through to
getSyncStatus and is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Modules are compared as a set: an item also in another Canvas module is
a difference, and Update in Canvas removes it from the others.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@teichert
teichert merged commit 3d02e2c into SnowSE:main Oct 12, 2026
@teichert
teichert deleted the fix/update-moves-module branch October 12, 2026 23:25
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.

1 participant