[Port to dtq-dev] fix(bitstream): restore item UUID in edit redirect#1319
Conversation
* fix(bitstream): restore item UUID in edit redirect fix(bitstream): restore item UUID in edit redirect * fix(bitstream): improve fallback navigation and error handling fix(bitstream): improve fallback navigation and error handling * proper cleanup on destroy (cherry picked from commit b4d2fac)
📝 WalkthroughWalkthroughThe edit-bitstream-bundle template now forwards ChangesBitstream Edit Navigation with itemId Resolution
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts (1)
418-429: ⚡ Quick winAdd a unit test for the fallback branch (
location.back()).This test covers the success path, but the new non-success RemoteData path in
navigateToItemEditBitstreams()is still untested. Adding that case will lock in the new error-handling behavior.As per coding guidelines, "New features must include new unit tests".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts` around lines 418 - 429, The test file currently only covers the success path where bundle.item resolves successfully, but the navigateToItemEditBitstreams() method also has a non-success RemoteData path that should trigger location.back(). Add a new test case that mocks a failed RemoteData object for bundle.item (using something like createFailedRemoteDataObject$) and verify that location.back() is called instead of router.navigate, ensuring the error-handling fallback behavior is properly tested.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts`:
- Around line 418-429: The test file currently only covers the success path
where bundle.item resolves successfully, but the navigateToItemEditBitstreams()
method also has a non-success RemoteData path that should trigger
location.back(). Add a new test case that mocks a failed RemoteData object for
bundle.item (using something like createFailedRemoteDataObject$) and verify that
location.back() is called instead of router.navigate, ensuring the
error-handling fallback behavior is properly tested.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 443adec9-3173-451e-b398-17fdc73066b0
📒 Files selected for processing (3)
src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.tssrc/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.tssrc/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.html
There was a problem hiding this comment.
Pull request overview
Fixes navigation back to an Item’s edit → bitstreams tab after editing a Bitstream by ensuring the originating Item UUID (and entity type when available) is preserved via query params and recoverable from the owning bundle when missing.
Changes:
- Pass
itemIdandentityTypeas query params when navigating from the Item bitstreams edit table to the Bitstream edit page. - Update
navigateToItemEditBitstreams()to recover a missingitemIdfrombundle.itembefore redirecting (fallback tolocation.back()if unavailable). - Add unit test coverage for the fallback resolution of
itemIdfrombundle.item.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.html |
Adds query params (itemId, entityType) to the Bitstream edit routerLink to preserve context for return navigation. |
src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts |
Makes the “back to item bitstreams tab” navigation resilient when itemId is absent by resolving it from the owning bundle’s item. |
src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts |
Adds a spec asserting that missing itemId is resolved from bundle.item and redirects correctly. |
Port of ufal#154 by @amadulhaxxani to
dtq-dev.Summary by CodeRabbit