Skip to content

[Port to dtq-dev] Refresh file listings on breadcrumb navigation after bitstream upload#1280

Merged
milanmajchrak merged 2 commits into
dataquest-dev:dtq-devfrom
ufal:backport-112-to-dtq-dev
Jun 3, 2026
Merged

[Port to dtq-dev] Refresh file listings on breadcrumb navigation after bitstream upload#1280
milanmajchrak merged 2 commits into
dataquest-dev:dtq-devfrom
ufal:backport-112-to-dtq-dev

Conversation

@kosarko
Copy link
Copy Markdown

@kosarko kosarko commented Apr 28, 2026

Port of ufal#112 by @amadulhaxxani to dtq-dev.

…#112)

* Refresh file listings on breadcrumb navigation after bitstream upload

Refresh file listings on breadcrumb navigation after bitstream upload

* Move refresh logic to ngOnChanges

Move refresh logic to ngOnChanges

* Set related requests stale instead of removing cache

Set related requests stale instead of removing cache

* Use setStaleByHrefSubstring for metadatabitstreams cache

Use setStaleByHrefSubstring for metadatabitstreams cache

* Add null checks for nested RemoteData access

Add null checks for nested RemoteData access

* Use local bitstream refs and clear caches

Replace uses of this.bitstream with the local bitstream observable in edit-bitstream-page to reference the correct stream when computing image/IIIF/enabled flags.

After removing bitstreams, clear relevant caches in item-bitstreams: mark bundle bitstreams hrefs stale and invalidate metadatabitstreams search-by-handle (both encoded and raw variants) so file lists, previews and CLARIN file sections refresh correctly.

* Fix memory leak, null guard, and style issues from PR review

- PreviewSectionComponent: store and unsubscribe configService subscription
  in ngOnDestroy to prevent memory leak
- ItemBitstreamsComponent: add hasValue() null guard before bundles.forEach()
  for idiomatic style

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ondrej Kosarko <kosarko@ufal.mff.cuni.cz>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 45bacd6)
Copy link
Copy Markdown

Copilot AI left a comment

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 ports changes to ensure item-related file listings (Preview section, CLARIN files section, and breadcrumb-driven item navigation) refresh correctly after bitstream uploads/removals by staling relevant request caches and reloading file metadata when inputs change.

Changes:

  • Refresh Preview/CLARIN file lists on @Input changes via OnChanges + managed subscriptions.
  • After upload/removal, mark item/bundle/metadatabitstreams requests as stale so subsequent navigation resolves fresh data.
  • Harden breadcrumb + edit-bitstream flows with additional hasValue checks to avoid null/undefined relation crashes.

Reviewed changes

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

Show a summary per file
File Description
src/app/item-page/simple/field-components/preview-section/preview-section.component.ts Reload preview file list on item input changes; manage subscriptions.
src/app/item-page/simple/field-components/preview-section/preview-section.component.spec.ts Update unit test to trigger refresh via ngOnChanges.
src/app/item-page/item.resolver.ts Enable re-request-on-stale for item resolver to support refreshed breadcrumb navigation.
src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.ts After removal, mark bundle bitstreams + metadatabitstreams-byHandle caches stale to refresh listings.
src/app/item-page/clarin-files-section/clarin-files-section.component.ts Reload CLARIN files list on input changes; manage subscription lifecycle.
src/app/item-page/bitstreams/upload/upload-bitstream.component.ts After upload, mark bundle bitstreams, item bundles, item self, and byHandle search caches stale.
src/app/item-page/bitstreams/upload/upload-bitstream.component.spec.ts Extend tests to assert all expected cache-stale calls occur after upload.
src/app/core/breadcrumbs/bitstream-breadcrumbs.service.ts Guard against missing bundle/item relations while resolving breadcrumbs.
src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts Add defensive handling for missing relations in bundle/item/format and IIIF detection pipeline.

@milanmajchrak milanmajchrak merged commit 3a219e4 into dataquest-dev:dtq-dev Jun 3, 2026
6 of 7 checks passed
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.

4 participants