Repository navigation
Make the form pickers keep typed text, start with large types and survive a lost circuit - #2655
Merged
Merged
Conversation
…ny page with typed input
…sen asset with its folder
…ET, and disable old matches after a loss
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.
Closes #2639
What
Follow-ups from the independent review of #2622 (F-FRM, #2426).
The search box owns its text. The server never writes
valueback, so a key typed while a search runs is never lost.admin.jsempties the box after a choice.The island takes no option list. Its parameters are the field, the chosen id and text, so the circuit's start message stays small however many entries or assets there are.
EntryEditorno longer loads every entry and asset for its pickers.Every read goes through a scope of its own. The pickers of a form load at once, and searches overlap as the person types, while a
DbContexttakes one query at a time. This is the rule from Run the header counts in their own scope so signed-in pages load on PostgreSQL #2642.A search waits for a 250 ms pause in typing, and only the newest search shows its results.
The media picker asks the library for its text.
MediaQuerygains:Text, which matches a file name or folder whatever its case;Newest, which returns that many of the newest assets, newest first.The text is matched in .NET over the names alone, because SQLite's
lower()folds ASCII letters only. Only the matching assets are read after that, so the picker no longer reads every asset on every keystroke.Enter in the box never submits the form. It chooses the only match, or enters the list when there are more (
admin.js).data-for). Enter acts only when the box still holds that text, so a fast typist never chooses a match left from an earlier word.Focus stays in the box after a choice, Clear or Escape.
The choice is kept with the circuit (
[PersistentState], keyed by field). A circuit paused and resumed, as after a laptop sleeps, keeps what the person chose rather than going back to the stored value. A new stored value replaces it, as when enhanced navigation shows another version of the entry.A choice is named by the type's first text field, in definition order, with its state and short id. An entity's fact value counts. The chosen option in the prerendered select is named the same way.
A lost circuit doesn't reload a page whose form holds a picker or any typed input, such as a rejection reason on the set view.
popstatelistener reloads the page instead. Without a circuit nothing can render the next page's islands, and an enhanced navigation would keep this page's: another version's picker choice, or another set's items.A choice made in the select before the circuit attaches is still replaced by the stored one. That is #2654. The select still reads every entry of its type to show the newest 200. That is #2656.
Why
valueon the box rather than@bind. Every server render writes a bound value back, and that write is what dropped keys under latency. The box needs no server state between keys: the search reads the text from the event.Tests
FocusAsync, on a target type of 500 entries:Newestkeeps the newest first.dotnet build -warnaserror, the unit and bUnit suite, the browser tests on SQLite and PostgreSQL, and the form and media tests pass locally. No new package and no new project reference.Checklist
v2