github / github/remote-input-element

Ability to prevent/cancel fetch on focus

Offen
#31 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
91
Forks
17
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
5

Beschreibung

I'm using the remote input in a [SelectMenu](https://primer.style/css/components/select-menu#githubcom-usage). The menu's SelectMenu-list is controlled by the remote input. When the page is rendered server-side, a few commonly used items are rendered in the SelectMenu-list to save the user time. The problem I have is these items are instantly cleared when the SelectMenu opens and the remote input receives focus due to the remote input doing the initial fetch.

Would the team be open to a PR that makes it possible to skip/cancel the initial fetch? I'd like to avoid the unnecessary round-trip to the server to get suggestions for the empty string query and preserve by server-side rendered default SelectMenu items. If yes, should it be done via html attribute or by preventing default on one of the custom events?

Two other questions:
1. Should load fire before the fetch starts?
https://github.com/github/remote-input-element/blob/4ec740a69773f4b18dfeef28d52434b0475bcd13/src/index.ts#L132-L134
2. Most github elements store state in a weakmap and use module functions (as opposed to class properties and methods). This makes it difficult to monkey patch component behavior. Is that the intent?

Thank you for sharing the github elements. They're super useful and I love the decoupling of the styles from the behavior.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with src/index.ts around lines 132-134 and trace the focus-triggered initial fetch and its custom events. Determine how an opt-out or cancellation API should interact with the remote input and server-rendered SelectMenu-list items, then define completion as preserving those items without the empty-query request. The issue does not mention a test file, so locate the existing fetch or event coverage before changing behavior.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.