Skip to content

Conversation

@nicobytes
Copy link
Contributor

@nicobytes nicobytes commented Feb 10, 2026

This pull request introduces improvements to the folder tree loading and browsing logic in the dotCMS UI, focusing on better handling of paginated folder responses, preventing unnecessary tree overwrites, and improving test coverage. The changes also refine the build and serve configurations for the development environment.

Folder tree loading and browsing improvements:

  • Added logic in DotBrowsingService to unshift the parent folder into the next paginated response when it is missing, ensuring the tree can be correctly built even when pagination omits intermediate folders. (Fa220796L139, core-web/libs/ui/src/lib/services/dot-browsing/dot-browsing.service.spec.tsR519-R596)
  • Refactored folder tree node creation into a dedicated private method #createFolderTreeNode for clarity and reuse. [1] [2]
  • Improved path normalization in #createPaths to handle default /index routes, preventing them from being treated as folders.

Folder tree loading safeguards:

  • Updated the loadChildren method in HostFolderFiledStore to skip loading children if the node already has children, avoiding overwriting the tree and losing pagination-related injected items.

Test coverage enhancements:

  • Added new tests for loadChildren to verify correct behavior when loading children for nodes with and without existing children.
  • Added a test in DotBrowsingService to ensure parent folders are correctly inserted into paginated responses, allowing the tree to be built properly.

Development build and serve configuration changes:

  • Adjusted project.json to enable source maps and named chunks, set proper baseHref, and improved the serve target with continuous mode and live reload for development. [1] [2]

Test file cleanup:

  • Reordered imports and applied minor cleanup for clarity in test files.

This PR fixes: #34275

- Updated development settings: consolidated outputPath and baseHref for clarity.
- Enabled source maps and named chunks for better debugging.
- Enhanced serve options with continuous mode and default configuration for development.
- Added production configuration for build target specification.

These changes streamline the build process and improve development experience.
- Introduced tests to verify the behavior of loadChildren method when loading folder children.
- Ensured that the method correctly updates nodes without children and avoids overwriting existing children.
- Enhanced test coverage for the HostFolderFiledStore to improve reliability and maintainability.
- Updated the #createPaths method to simplify path normalization by directly splitting the input path.
- Enhanced logic to remove the last segment if it is 'index', addressing potential issues with backend URL handling.
- This change improves the consistency of URL processing and ensures that default routes are handled correctly.
…/core into 34275-host-or-folder-field-issues
@nicobytes
Copy link
Contributor Author

@claude code review

Copy link
Contributor

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

Improves dotCMS UI host/folder field browsing by making folder-tree construction more resilient to paginated folder responses, preventing unintended tree overwrites on expand, and adjusting local dev build/serve settings.

Changes:

  • Refactors DotBrowsingService folder TreeNode creation and enhances buildTreeByPaths to handle missing parent folders across paginated responses.
  • Adds a safeguard in HostFolderFiledStore.loadChildren to avoid reloading/overwriting existing children.
  • Updates dotcms-ui development build/serve configuration and adds/adjusts related unit tests.

Reviewed changes

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

Show a summary per file
File Description
core-web/libs/ui/src/lib/services/dot-browsing/dot-browsing.service.ts Refactors folder node creation and injects missing parent nodes into paginated responses during tree building.
core-web/libs/ui/src/lib/services/dot-browsing/dot-browsing.service.spec.ts Adds coverage for the “missing parent in paginated response” tree-building scenario.
core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/store/host-folder-field.store.ts Prevents loadChildren from overwriting existing node children.
core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/store/host-folder-field.store.spec.ts Adds tests validating loadChildren behavior for nodes with/without existing children.
core-web/apps/dotcms-ui/project.json Tweaks development build output and serve behavior for local dev workflow.

…handling

- Changed the logic to access the last segment of the split path array directly instead of using the `at()` method, enhancing readability and performance.
- This update ensures consistent handling of paths, particularly when dealing with default routes like '/index'.

No functional changes were introduced, maintaining existing behavior while improving code clarity.
- Implemented a new test case to verify the behavior of loadChildren when a node has an empty children array.
- Ensured that the method correctly calls getFoldersTreeNode and updates the node with the fetched folders.
- Updated the loadChildren logic to handle nodes with empty children arrays while preventing overwriting existing children.

This enhances test coverage and reliability of the HostFolderFiledStore functionality.
@nicobytes nicobytes enabled auto-merge February 10, 2026 22:01
@nicobytes nicobytes added this pull request to the merge queue Feb 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 10, 2026
@nicobytes nicobytes added this pull request to the merge queue Feb 11, 2026
Merged via the queue into main with commit fb65064 Feb 11, 2026
19 checks passed
@nicobytes nicobytes deleted the 34275-host-or-folder-field-issues branch February 11, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[DEFECT] The Host or Folder field value is not showing up in New Edit Mode

4 participants