Repository navigation
feat(ou-tree): search mode: search input, pruned tree with paged results, highlighting and reveal - #1787
Merged
HendrikThePendric merged 39 commits intoNov 17, 2026
Conversation
…find a match's range The fixture's matcher moves to src/ou-tree/search/ so the client matches as the stand-in and the backend do. findMatch returns the matched range in the label's own indexes through a per-character fold that keeps each folded character's origin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…order The store fetches one page of a filtered query and stores every entry of it; the pruned tree appends each result's path from the first shown root down, which is in order because results arrive in tree order. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…laceholders Node rows carry their view and whether they are a result; filtered mode walks the pruned tree, switches to the browse walk under revealed nodes and appends a placeholder row per result not received yet. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…r with reveal search resets the tree and requests page one; later pages are requested one at a time when a placeholder row is in range. Page answers build the pruned tree from the given roots the store has, so a search works before the roots answered. A revealed node is a browse pocket; open and toggle act only on browse rows. clearSearch restores initiallyOpen. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
setSearchInput trims the value, clears any search at once below SEARCH_MIN_LENGTH and otherwise runs it after SEARCH_DEBOUNCE_MS. getSearchStatus derives idle, too-short, loading, loaded or failed and keeps its object while nothing changed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
useOuTreeSearch gives an input the typed value, the debounced setter, the status and help text while the term is too short; useOuTreeSearchTerm gives labels the effective term. useOuTree gains mode and searchStatus, useOuTreeNode isResult and isRevealed, useOuTreeActions the search, reveal and results-page retry actions. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
OuTreeMatchedText emphasises the term's match in a label, or all of it for a quoted or wildcard term; OuTreeNodeLabel paints a result's background; OuTreeRevealToggle is the eye after a pruned node's label, shown by OuTreeRowShell only on hover or focus within through the data-hover-only attribute; OuTreeNoResults is the empty line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…the search input A pruned row has the toggle space, the match marked in the label, the result background and the eye; a revealed node shows its browse children under it with the retry body when their page failed. The placeholder rows render result-skeleton and result-error rows too, OuTreeList shows the filtered rows whatever the roots status or the no-results line, and OuTreeSearchInput is an InputField over useOuTreeSearch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Search and SearchFailing compose OuTreeSearchInput over OuTreeList; the building blocks show the input's three states, the matched text, the reveal toggle and the no-results line. The stand-in's failWith already rejects a tree page, so the failing story needs no new option. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… its path stops short search(term) with a blank term would match everything; it now clears any search. addResults appends the result itself when its path ends at its parent, as the spec says, instead of dropping it unreported. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…atching branches open One open set serves both modes. A node with matching children opens when the page that places it arrives, unless the user closed it, and shows its matching children; a result without any starts closed and opens to all of its children, which marks it revealed, so a later page placing a result under it does not narrow the list. The eye shows only on an open node with matching children, and on one whose reveal failed, as the way back; revealing opens the node and closing keeps the reveal. A pruned-tree node keeps its view wherever it is listed, under a revealed ancestor included. useOuTreeNode gains hasMatchingChildren. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…o second clear cross InputField does not forward a role, so the input is a textbox until the focus work gives it searchbox. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…rounds do not touch The label sits on a 20px line box with a 2px margin inside the 24px row, as the skeleton bars do; the text stays where it was. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…complete list is loaded Revealing switched the walk to the slots at once, so the matching children vanished while page one loaded. They now stay, the loader in the arrow slot, until the page is loaded; if it fails the node stays open on them with the retry body, which calls open. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
HendrikThePendric
changed the base branch from
master
to
feat/paged-org-unit-tree
October 29, 2026 16:12
…p an index loop Resolves the five SonarCloud code smells on #1787 that are not about keyboard access: S3358 in OuTreeList and OuTreeMatchedText, S6582 in flattenRows and the tree state, S4138 in foldTextWithOrigin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
|
🚀 Deployed on https://pr-1787--dhis2-ui.netlify.app |
…e index segment JavaScript keeps index.js for the web standards; for TypeScript the plain directory import is the norm. No resolution or build effect. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…children-error The row kinds for an empty slot of a parent's children were skeleton and error, next to batch 4's result-skeleton and result-error, so the retry branch in OuTreeErrorRow read as error versus result rather than children versus results. Paging names say which kind they mean; now the rows do too, data-row-kind and row keys included. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ith early returns OuTreeList is the container around it and no longer subscribes to the tree. ListContent is always mounted and calls the virtualiser hook before its returns, so the virtualiser keeps its measurements across the no-results and roots states as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ody with early returns Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
splitMatches replaces findMatch: it cuts a label into plain and matched segments, every non-overlapping occurrence of a plain term or the whole label for a quoted or wildcard term, so OuTreeMatchedText and a custom label map the same list. The module is now search/match-segments.ts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… row render createMatchSplitter(term) does the per-term work once; the tree state keeps the splitter with the search and useOuTreeMatchSplitter exposes it. OuTreeMatchedText takes segments and computes nothing, and renderLabel gets the splitter as splitMatches. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
stripCaseAndAccents and stripCaseAndAccentsWithPositions, with a sourceIndex, replace foldText, foldTextWithOrigin and origin; the two curried splitter helpers become one splitAtOccurrences and a closure with three cases; the docs open with a worked example. No behaviour change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
rendersTheSame and reuseUnchanged name the row reuse across rebuilds, pushChildSlots and pushResultPlaceholders say what they push, walkPruned reads the filtered view from the closure instead of a parameter, and the doc describes each mode in its own paragraph. No behaviour change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…hey could shrink Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ot or ancestors A result with no shown root in its path, or with an ancestor the store does not hold, breaks the tree endpoint's contract. Dropping it with a dev-only warning hid the bug behind a tree that looked complete; the throw names the result and the contract, and the app keeps running. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s not hold Every id the walk lists comes from the store, so a missing one is a bug; skipping it drew a tree with a branch quietly gone. walkPruned takes the filtered view instead of guarding on it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… its children 'browse' named a mode, not how a node lists its children, and a node listing all of them appears in both modes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…t filtered The mode names are now the pair browse and search, the words the actions and state already use; SearchView, searchView and the test file follow. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…does Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… part of the walk's input View now names how a node lists its children; the search's slice of the row walk's input is not a view of anything. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…of flattenRows reuseUnchanged, nodeOf and the result placeholder rows need no walk state, so they sit at module scope next to rendersTheSame; flattenRows keeps only the mutually recursive walk over its accumulator. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…esult scrolls into view A revealed node lists its children from children pages, so a child that is a result on a page not received yet showed plain, a false non-match, until a placeholder below the whole list came into view. Results arrive in tree order, so the last received result always precedes such a child; its row in view now requests the next page, a step ahead of the scroll. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…t page Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Changes and rows, browsing, searching, reveal and hover, loading what scrolls into view, start. The two pure helpers, searchRowsInput and sameStatus, move to module scope. No behaviour change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
HendrikThePendric
merged commit Nov 17, 2026
6961681
into
feat/paged-org-unit-tree
6 of 7 checks passed
Open
5 tasks done
This branch was previously deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




Implements DHIS2-21263 (client side, batch 4 of
OuTree)Description
Search mode for
OuTree: a search over the tree endpoint, scoped to the tree's roots, shown as the tree pruned to the matching branches. Still over the stand-in, still not exported.useOuTreeSearchowns the term: trimmed, at least 2 characters (SEARCH_MIN_LENGTH), debounced by 300 ms (SEARCH_DEBOUNCE_MS), with the help text and a status (idle,too-short,loading,loadedwith the total,failed).OuTreeSearchInputis anInputFieldover that hook; an app can bring its own input. New dependency on@dhis2-ui/input.RESULTS_PAGE_SIZE, 50) load in order as you scroll, with skeleton rows for results not received yet and retry rows for a failed page; a late answer for an earlier term is dropped. The next page is also requested when the last received result scrolls into view, so a revealed node's children, which may hold results from later pages, stay a page ahead of the scroll instead of showing such a result plain. The pruned tree (tree/pruned-tree.ts) is built from the results and their paths, and does not wait for the roots.yellow100background. Where the client finds the term in the name (search/match-segments.ts, shared with the stand-in) every occurrence is bold; a quoted or wildcard term marks the whole name. The tree builds one match splitter per search (createMatchSplitter, exposed byuseOuTreeMatchSplitter), so the per-term work is done once for all rows;OuTreeMatchedTextonly renders the segments.renderLabelgetsisResult,searchTermandsplitMatchesfor custom labels.isHovered,setHovered), reported byOuTreeRowShellthroughonHoverChange, so batch 5 can add the focused row the same way.useOuTreeaddsmodeandsearchStatus;useOuTreeNodeaddsisResult,isRevealed,hasMatchingChildrenandisHovered;useOuTreeActionsaddssearch,clearSearch,toggleRevealed,retryResultsPageandsetHovered; newuseOuTreeSearchTermanduseOuTreeMatchSplitter.browseandsearch, and a node's viewfullorprunedby how it lists its children; the row kinds for a parent's children pages arechildren-skeletonandchildren-error, next toresult-skeletonandresult-error; TypeScript imports name a barrel's directory, without/index; a broken endpoint contract (a result without its root or ancestors, a listed id the store lacks) throws instead of being dropped with a warning.Search(tryclin,san jos,"Rio de Janeiro"andsan*) andSearchFailing, plus building blocks for the new pieces.Left for later:
groups,levelandcurrentlyOpen; a result counter, which an app renders fromstatus.total. The result colours are starting points to tune. For batch 5, with the focus model: the eye on the focused row as well as the hovered one, thesearchboxrole on the input, and shrinking node rows to kind, id, depth and view so the row component reads the rest throughuseOuTreeNodeand row reuse becomes the key plus depth.Known issues
treeitem, and the eye renders only while the row is hovered, so neither is keyboard-reachable yet. Batch 5's focus model owns both.type="text", since Chromium draws a second clear cross fortype="search"; the searchbox role comes with batch 5.useVirtualizerremains, as in batch 3.Checklist
Screenshots
The
Searchstory over the PAHO stand-in, searchingclin: Georgia collapsed from its arrow; Georgia being revealed, with Clinch still listed while its counties load; Georgia revealed under a revealed United States.🤖 Generated with Claude Code