You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug fix (non-breaking change which fixes an issue)
Description
Tree Node v2 stored an expand-icon "loading" state per node and resolved it via a broken heuristic (a node's id reappearing in some later datasource delivery), which a microflow datasource breaks in two ways: a permanently stuck loading spinner when "Start expanded" is Yes, and an unrelated node silently and permanently losing its expand icon when a sibling is expanded (WC-3564). The spinner is now a pure render-time decision driven by the datasource's own status, never stored per node.
Manual verification of that fix surfaced two further pre-existing bugs in the same "preload one level ahead" mechanism, fixed in the same PR since they were found and understood during the same pass: a node's first expand didn't preload its own children's children (needed a collapse+re-expand to reveal a deeper tier), and the automatic root-expansion path for "Start expanded" = Yes only went one level deep instead of cascading to the tree's real depth (every level defaults to expanded in that mode, not just roots).
What should be covered while testing?
Tree Node v2, microflow datasource, "Start expanded" = Yes → tree renders fully expanded immediately, all the way to the data's real depth, no stuck spinner
Tree Node v2, "Start expanded" = No, expand a node, then expand an unrelated sibling → first node's expand icon stays intact, still clickable, reveals its own children correctly
Expand a node once → its children's own expand icons are correct immediately (no collapse+re-expand needed to reveal a deeper tier)
With "Start expanded" = Yes, deeper tiers (3rd, 4th, ...) appear automatically on load, not requiring a manual collapse/re-expand anywhere
DevTools console — no errors during any of the above
v1 widget (no parentAssociation configured) — spot-check unaffected, this change only touches v2 code paths
No XML changes; this is a bug fix restoring intended behavior, not a new feature — no docs PR needed. Changelog entries already added under [Unreleased].
File:packages/pluggableWidgets/tree-node-web/src/components/v2/__tests__/TreeNodeV2.spec.tsx lines 25–41, 43–64 Note: The test file constructs ListValue, ListExpressionValue, and ListReferenceValue by hand. The repo's @mendix/widget-plugin-test-utils provides ListValueBuilder, listReference, dynamic.*, etc., which are the expected pattern (used correctly in useIncrementalTreeData.spec.ts and useInfiniteTreeNode.spec.ts). The hand-rolled mocks aren't wrong, but they skip status edge cases (e.g. ValueStatus.Loading, ValueStatus.Unavailable) that the builders make trivial to inject. Worth aligning in a follow-up to keep the two test files consistent.
⚠️ Low — showSpinner is also true when the datasource is loading but the node is already expanded
File:packages/pluggableWidgets/tree-node-web/src/components/v2/TreeNode.tsx line 24 Note: The current logic is const showSpinner = !hasChildren && isDatasourceLoading. When isDatasourceLoading is true and a node has been expanded (its children are present, so hasChildren is true), the spinner is correctly suppressed. However, a collapsed node with known children will show a spinner while the datasource is loading more items for other nodes, because !hasChildren is false — actually, that case is fine. The subtle risk is the opposite: a node that was expanded and then the user collapses it — hasChildren is still true, so no spinner, which is also correct. The logic is sound; this is just noting that the relationship between isDatasourceLoading (which is the whole datasource's status, not a per-node status) and a node's own loading state is implicit. A brief inline note on line 24 explaining "whole-datasource loading" would help the next reader, but this is genuinely non-blocking.
Positives
The core fix — removing per-node LOADING state entirely and deriving spinner visibility at render time from datasource.status — is exactly the right approach. Stored loading state was the root cause of all three bugs; removing it eliminates the class of problem, not just the current instances.
The startExpanded=true cascade in useInfiniteTreeNode is content-gated (checks whether addedAny is true) rather than fire-count-gated, which is the correct self-terminating design and directly addresses the transient-empty-delivery regression.
round1DoneRef / round2DoneRef being content-gated (locked in only once loadedParentsByIdRef.current.size > 0) is a precise and minimal fix for the premature lock-in bug.
useIncrementalTreeData.spec.ts uses @mendix/widget-plugin-test-utils builders (listReference, dynamic.*) consistently — the right pattern.
The useInfiniteTreeNode.spec.ts cascade test is particularly thorough: it simulates transient empty deliveries, unchanged re-deliveries, and per-level progression in sequence, all in one test, which exactly mirrors the scenario that was previously broken.
Changelog entries are user-facing and describe behavior changes (not implementation details), matching the project convention.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
Tree Node v2 stored an expand-icon "loading" state per node and resolved it via a broken heuristic (a node's id reappearing in some later datasource delivery), which a microflow datasource breaks in two ways: a permanently stuck loading spinner when "Start expanded" is Yes, and an unrelated node silently and permanently losing its expand icon when a sibling is expanded (WC-3564). The spinner is now a pure render-time decision driven by the datasource's own
status, never stored per node.Manual verification of that fix surfaced two further pre-existing bugs in the same "preload one level ahead" mechanism, fixed in the same PR since they were found and understood during the same pass: a node's first expand didn't preload its own children's children (needed a collapse+re-expand to reveal a deeper tier), and the automatic root-expansion path for "Start expanded" = Yes only went one level deep instead of cascading to the tree's real depth (every level defaults to expanded in that mode, not just roots).
What should be covered while testing?
parentAssociationconfigured) — spot-check unaffected, this change only touches v2 code pathsNo XML changes; this is a bug fix restoring intended behavior, not a new feature — no docs PR needed. Changelog entries already added under
[Unreleased].Ticket: WC-3564