-
Notifications
You must be signed in to change notification settings - Fork 480
34275 host or folder field issues #34590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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
|
@claude code review |
There was a problem hiding this 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
DotBrowsingServicefolder TreeNode creation and enhancesbuildTreeByPathsto handle missing parent folders across paginated responses. - Adds a safeguard in
HostFolderFiledStore.loadChildrento avoid reloading/overwriting existing children. - Updates
dotcms-uidevelopment 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. |
core-web/libs/ui/src/lib/services/dot-browsing/dot-browsing.service.ts
Outdated
Show resolved
Hide resolved
...t-content/src/lib/fields/dot-edit-content-host-folder-field/store/host-folder-field.store.ts
Outdated
Show resolved
Hide resolved
…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.
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:
DotBrowsingServiceto 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)#createFolderTreeNodefor clarity and reuse. [1] [2]#createPathsto handle default/indexroutes, preventing them from being treated as folders.Folder tree loading safeguards:
loadChildrenmethod inHostFolderFiledStoreto skip loading children if the node already has children, avoiding overwriting the tree and losing pagination-related injected items.Test coverage enhancements:
loadChildrento verify correct behavior when loading children for nodes with and without existing children.DotBrowsingServiceto ensure parent folders are correctly inserted into paginated responses, allowing the tree to be built properly.Development build and serve configuration changes:
project.jsonto enable source maps and named chunks, set properbaseHref, and improved theservetarget with continuous mode and live reload for development. [1] [2]Test file cleanup:
This PR fixes: #34275