Languages: Page through to load all configured languages - #22765
Conversation
…where the number of languages exceeds the default page size.
|
Claude finished @AndyButland's task in 3m 33s —— View job PR ReviewTarget: Adds a generic
Suggestions
Approved with Suggestions for improvementGood to go, but please carefully consider the importance of the suggestions. The fix is well-scoped: the utility is generic, correctly handles all edge cases (single page, multi-page, exact-fill, empty, mid-page error, empty-page guard), is fully tested, and all 13 call sites have been consistently migrated including the previous |
There was a problem hiding this comment.
Pull request overview
This PR ensures the backoffice always loads the full configured language set (even when there are more than the server default page size of 100) by introducing a reusable offset-pagination “fetch all pages” utility and migrating existing call sites to use a new requestAllItems() repository API.
Changes:
- Added a generic
fetchAllPages<T>helper for offset-paginatedUmbPagedModel<T>sources (with unit tests). - Added
UmbLanguageCollectionRepository.requestAllItems()to page through and return the full language set. - Updated multiple UI contexts/actions to replace single-page
requestCollection({})(andtake: 999/1000workarounds) withrequestAllItems().
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/preview/preview-apps/preview-culture.element.ts | Loads cultures via full language retrieval to avoid truncation past 100. |
| src/Umbraco.Web.UI.Client/src/packages/multi-url-picker/document-link-picker-modal/document-link-picker.context.ts | Loads the complete language list for the link picker modal. |
| src/Umbraco.Web.UI.Client/src/packages/language/modals/language-picker/language-picker-modal.element.ts | Ensures language picker modal receives all configured languages. |
| src/Umbraco.Web.UI.Client/src/packages/language/global-contexts/app-language.context.ts | App language global context now pulls the full language set. |
| src/Umbraco.Web.UI.Client/src/packages/language/collection/repository/language-collection.repository.ts | Adds requestAllItems() that pages through language collection results. |
| src/Umbraco.Web.UI.Client/src/packages/language/app-language-select/app-language-select.element.ts | App language selector now uses full language retrieval. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/unpublish/entity-bulk-action/unpublish.bulk-action.ts | Uses full language list during unpublish bulk action flows. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/unpublish/entity-action/unpublish.action.ts | Uses full language list during unpublish single action flows. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/publish/entity-bulk-action/publish.bulk-action.ts | Uses full language list during publish bulk action flows. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/publish/entity-action/publish.action.ts | Uses full language list during publish single action flows. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.ts | Removes take: 999 workaround by paging all languages. |
| src/Umbraco.Web.UI.Client/src/packages/dictionary/workspace/views/workspace-view-dictionary-editor.element.ts | Ensures dictionary editor view gets all languages. |
| src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts | Ensures dictionary table view columns cover all languages. |
| src/Umbraco.Web.UI.Client/src/packages/core/utils/pagination/offset/index.ts | Exposes the new pagination helper from the offset pagination utils barrel. |
| src/Umbraco.Web.UI.Client/src/packages/core/utils/pagination/offset/fetch-all-pages.function.ts | Implements generic offset “fetch all pages” accumulation logic. |
| src/Umbraco.Web.UI.Client/src/packages/core/utils/pagination/offset/fetch-all-pages.function.test.ts | Adds unit tests covering paging scenarios and failure/safeguard behavior. |
| src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-workspace-base.ts | Content workspace language loading now retrieves the full language set. |
…t check (#23133) Backoffice: Move fetchAllPages into the repository module to break a core circular import #22765 added the offset pagination helper `fetchAllPages` under `@umbraco-cms/backoffice/utils`, but its contract is expressed entirely in repository-owned types (`UmbDataSourceResponse<UmbPagedModel<T>>`). That made `utils` import `repository` while `repository` already imports `utils`, introducing a 17th core bidirectional module import and tripping `check:module-dependencies` (threshold 16) — failing the `test` job on every open PR. Relocate the helper (and its test) into the `repository` module, which legitimately owns those types, and export it from `@umbraco-cms/backoffice/repository`. The sole consumer (UmbLanguageCollectionRepository) already imports from that module. Core bidirectional imports are back to 16. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Description
This PR is a follow-up to review feedback on #22711. The global content language selector — and twelve other places — called
UmbLanguageCollectionRepository.requestCollection({}), which falls through to the server's defaulttake = 100. Installations with more than 100 configured languages would silently lose the rest.In practice this seems very unlikely, so this update is likely an academic one, but nonetheless, as per the comment here, we should:
As this seemed it could be a more general requirement, I've introduced a generic
fetchAllPages<T>utility undersrc/packages/core/utils/pagination/offset/that pages through any offset-paginatedUmbDataSourceResponse<UmbPagedModel<T>>source untiltotalis reached.I've then added
UmbLanguageCollectionRepository.requestAllItems()on the language collection repository, delegating tofetchAllPageswith a page size of 100. And migrated all call sites across language, dictionary, multi-url-picker, preview, content, and document publish/unpublish actions fromrequestCollection({})(or workarounds liketake: 999/take: 1000) torequestAllItems().Testing
Unit test are added for
fetchAllPages.To manually test, temporarily change the page size at
src/Umbraco.Web.UI.Client/src/packages/language/collection/repository/language-collection.repository.ts, line 28 from 100 to a smaller value, that's less that the number of languages you have. Verify that all places where a list of languages are shown, that you see them all.