Skip to content

Conversation

@nicobytes
Copy link
Contributor

@nicobytes nicobytes commented Jan 30, 2026

Summary

This commit introduces a parent reference in the tree structure for better data management and updates related tests to ensure functionality.

Changes Made

Models

  • Added parent property to CustomTreeNode in dot-browser-selector.model.ts.

Store

  • Updated HostFolderFiledStore to utilize the new CustomTreeNode structure in host-folder-field.store.ts.

Service

  • Modified DotBrowsingService to include the parent reference in the tree response in dot-browsing.service.ts.

Tests

  • Expanded test cases in dot-browsing.service.spec.ts to validate the presence of the parent reference in tree structures for both single and multi-level paths.

Technical Details

The addition of the parent reference allows consumers of the tree structure to access the parent folder's hostname directly, improving the usability of the data model.

Testing

  • Unit tests added/updated to cover new functionality.
  • Manual testing performed to verify tree structure integrity and parent reference accessibility.

#34275

This PR fixes: #34275

…update tests

## Summary
This commit introduces a parent reference in the tree structure for better data management and updates related tests to ensure functionality.

## Changes Made
### Models
- Added `parent` property to `CustomTreeNode` in `dot-browser-selector.model.ts`.

### Store
- Updated `HostFolderFiledStore` to utilize the new `CustomTreeNode` structure in `host-folder-field.store.ts`.

### Service
- Modified `DotBrowsingService` to include the parent reference in the tree response in `dot-browsing.service.ts`.

### Tests
- Expanded test cases in `dot-browsing.service.spec.ts` to validate the presence of the parent reference in tree structures for both single and multi-level paths.

## Technical Details
The addition of the parent reference allows consumers of the tree structure to access the parent folder's hostname directly, improving the usability of the data model.

## Testing
- [x] Unit tests added/updated to cover new functionality.
- [x] Manual testing performed to verify tree structure integrity and parent reference accessibility.
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

This PR fixes a bug where the "Host or Folder" field value was not displaying in the new Edit Mode for HTML pages. The root cause was that the parent property was missing from the tree structure returned by DotBrowsingService, causing the store code that accessed tree.parent.hostName to fail with a null reference error.

Changes:

  • Added parent property to the CustomTreeNode type definition to include parent folder information
  • Modified DotBrowsingService.buildTreeByPaths() to populate the parent reference in the tree response
  • Added explicit type annotation in HostFolderFiledStore for better type safety
  • Added comprehensive unit tests to verify the parent reference is always present in both single-level and multi-level folder paths

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
core-web/libs/dotcms-models/src/lib/dot-browser-selector.model.ts Added optional parent?: DotFolder property to CustomTreeNode type and imported DotFolder model
core-web/libs/ui/src/lib/services/dot-browsing/dot-browsing.service.ts Updated buildTreeByPaths() to include parent: node.parent in the tree structure; alphabetized imports
core-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/store/host-folder-field.store.ts Added CustomTreeNode type annotation and import; alphabetized imports
core-web/libs/ui/src/lib/services/dot-browsing/dot-browsing.service.spec.ts Added two comprehensive test cases verifying parent reference exists for single and multi-level paths; alphabetized imports

…tailed documentation

### Changes Made
- Added comprehensive JSDoc comments to `TreeNodeData`, `TreeNodeItem`, `TreeNodeSelectItem`, and `CustomTreeNode` types in `dot-browser-selector.model.ts` for better clarity on their structure and usage.
- Updated `HostFolderFiledStore` to utilize the new `CustomTreeNode` type in `host-folder-field.store.ts`, ensuring type safety and improved readability.

### Motivation
These enhancements improve the maintainability of the codebase by providing clear documentation for developers working with tree structures in the browser selector.

### Testing
- Manual testing performed to verify that the tree structure functions correctly with the updated types.
@nicobytes nicobytes enabled auto-merge February 2, 2026 15:11
@nicobytes nicobytes added this pull request to the merge queue Feb 2, 2026
Merged via the queue into main with commit e03c57e Feb 2, 2026
23 checks passed
@nicobytes nicobytes deleted the 34275-defect-the-host-or-folder-field-value-is-not-showing-up-in-new-edit-mode branch February 2, 2026 17:40
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