Repository navigation
PDFileExplorer: NavigateToItemAsync, and handler failures go to ExceptionHandler - #360
Merged
Merged
Conversation
…lects it; handler failures go to ExceptionHandler - NavigateToItemAsync(itemPath) loads the folders above an item into the tree without opening them, opens the item's folder once (one table load, one FolderChanged), selects the item and scrolls it into view. It returns false, with the deepest folder found open, when the item is not there, and a later call supersedes one still loading. NavigateToAsync is unchanged. - PDTree.LoadChildNodesAsync loads a node's children without expanding it or redrawing the tree; ToggleNodeIsExpandedAsync now uses it. - PDTable.ScrollItemIntoViewAsync scrolls a row into view by its key, no further than needed. - Without its toolbar the explorer has the pdfe-no-toolbar class and its splitter takes the full height. - PDFileExplorer and PDTree handle events through ComponentExceptionGuard: given an ExceptionHandler, a failure in an event handler is passed to it instead of ending the Blazor circuit; without one it is thrown as before. The explorer passes its own handler to its tree and table only when the application gave one. The tree's click timer now only hands the click to the dispatcher, the explorer's first render passes a failing toolbar state handler on, and PDTable's async void pager handlers pass a failure to ExceptionHandler. - Demo: a "Show a file" box on the PDFileExplorer page, and a Methods table in its documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 3 medium |
| Complexity | 1 medium |
🟢 Metrics 64 complexity · 6 duplication
Metric Results Complexity 64 Duplication 6
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
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.
Summary
Two changes to PDFileExplorer, for the Magic Suite Files search (MS-23441), and a hardening pass on the explorer and its tree.
Open a search result without stepping through every folder
NavigateToAsync(path)selects the root and then each folder on the way down, so the table loads and redraws once perfolder and
FolderChangedis raised for each. Opening a deep result visibly walks through every folder, and the itemitself is never selected.
PDFileExplorer.NavigateToItemAsync(itemPath)loads the folders above the item into the tree without openingthem, opens the item's folder once (one table load, one
FolderChanged), selects the item as a click would andscrolls it into view. It returns
false, leaving the deepest folder found open, when the item is not there. A latercall supersedes one that is still loading.
NavigateToAsyncis unchanged.PDTree.LoadChildNodesAsync(node)loads a node's children without expanding it or redrawing the tree.ToggleNodeIsExpandedAsyncnow uses it, with the same behaviour as before.PDTable.ScrollItemIntoViewAsync(key)scrolls a row into view, no further than needed, matching keys such as filepaths that are not valid CSS identifiers.
Splitter height without the toolbar
With
ShowToolbar="false"the toolbar was only hidden, and the splitter keptcalc(100% - 50px). The explorer now hasthe
pdfe-no-toolbarclass in that case, and its splitter takes the full height. With the toolbar shown nothingchanges.
main.scss,main.cssandmain.min.csswere edited by hand to match.Failures no longer end the circuit
IHandleEventthrough a new internalComponentExceptionGuard. Eventsare handled exactly as
ComponentBasedoes, rendering before and after, but when the application gives anExceptionHandlera failure in an event handler is passed to it instead of ending the Blazor circuit. Withoutone, a failure is thrown as before. The explorer passes its own handler to its tree and table only when the
application gave one, so that without one the tree does not swallow a failure.
in the selection, including in the application's handlers, vanished in an unobserved task.
try, and a failingUpdateToolbarStatehandleris passed on.
async voidpager handlers pass a failingPageChangedorPageSizeChangedhandler toExceptionHandler.Behaviour change: an application that already passes an
ExceptionHandlerto PDFileExplorer or PDTree nowreceives event failures there, where before they ended the circuit.
Not changed: PDTable has no guard of its own, its slow-click edit timer still starts the edit on a background task, and
public methods such as
NavigateToAsyncstill throw to their caller.Demo and docs
A Show a file box on the PDFileExplorer demo page (preset to
/Library/Templates/word_template.docx), and aMethods table in the explorer's documentation.
PackageReleaseNotesgains a paragraph after the unreleased PDChatnotes.
Testing
fails, a later call supersedes),
LoadChildNodesAsync,ScrollItemIntoViewAsync, the no-toolbar class, failinghandlers passed to
ExceptionHandlerin the explorer, the tree's click and keyboard, the explorer's first render andthe table's pager, and, for the explorer and the tree, that a failure still throws without an
ExceptionHandler.🤖 Generated with Claude Code