ReqoreCollection: add customFilter hook and pinned-group ordering

Aperta
#570 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Start with src/components/Collection/index.tsx, especially the built-in filter at lines 241–255 and group ordering at lines 471–481; then inspect the existing collection props and stories. Implement the agreed custom-filter and pinned-group API, preserving current default filtering and the stated Ungrouped behavior. Add a story for each feature and verify the acceptance criteria; virtualization is optional and lower priority.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Two related gaps surfaced while fixing qorus-ide app-catalogue issues (qorus-ide#235, #236, #237). Both have IDE-side workarounds today, but the upstream fix belongs here so every consumer benefits.

1. customFilter (or filterFn) prop on ReqoreCollection

Why we need it. Reqore's built-in filter is a single contiguous-substring check on each item's label + content + searchString (Collection/index.tsx:241-255). For larger catalogues this is too restrictive:

  • Multi-word queries match only when the words appear contiguously and in order. email watch customer returns nothing even when an action labelled "Customer.io: Watch email" exists. The fix is tokenise + AND across tokens, but there's no hook to override the matcher.
  • A consumer that does its own filtering upstream (e.g. relevance-scoring across joined apps + actions) then re-renders the Collection with the already-approved items has no way to disable Reqore's second pass. Today the qorus-ide AppCatalogue smuggles the raw query into each item's searchString so Reqore's .includes(query) trivially succeeds — a hack we'd rather not need.

Shape.

```ts
interface IReqoreCollectionProps {
// ...existing props
/** Replaces the built-in substring matcher when present.

  • Receives the item and the current query (already lowercased and
  • trimmed in the same way as the default matcher) and returns
  • true to keep the item. Skipped entirely when there is no query. */
    customFilter?: (item: IReqoreCollectionItemProps, query: string) => boolean;
    }
    ```

Default behaviour unchanged when omitted. Pairs cleanly with the existing `searchDelay` debounce.

2. Pinned-group ordering

Why we need it. Group ordering in Collection/index.tsx:471-481 is alphabetical via `localeCompare`, with only `'Ungrouped'` special-cased to the start. There is no API for a consumer to pin its own group at the top.

The qorus-ide app catalogue (qorus-ide#237) wants a synthetic "★ Favorites" group at the top of the apps list, above the alphabetically-sorted category groups. Today there is no clean way to do this — the closest workaround is naming the favorites group with a leading whitespace so it sorts before any letter, which reads like a bug and is locale-fragile.

Shape (proposal A — bulk).

```ts
interface IReqoreCollectionProps {
/** Group names to render at the top of the list, in the given

  • order, before the alphabetically-sorted groups. `'Ungrouped'`
  • remains pinned to the very start of the result unless explicitly
  • included here. */
    pinnedGroups?: string[];
    }
    ```

Shape (proposal B — per-group). Already supported types make this cleaner: extend the existing `IReqoreCollectionGroup` (already addressable via the `groups` prop) with an optional `order: number` field. Groups with an `order` sort by it ascending before the unordered groups, which then fall back to alphabetical.

```ts
interface IReqoreCollectionGroup extends IReqorePanelProps {
/** When set, this group is placed at this index in the sorted list

  • before alphabetical sorting kicks in for the remaining groups.
  • Lower numbers render higher. */
    order?: number;
    }
    ```

Either shape works. Proposal A is the smallest API surface; proposal B reuses the existing `groups` config prop and lets a consumer mix per-group styling with ordering without duplicating the group name across two props.

3. (Optional) Item virtualization

Not blocking — flagging because qorus-ide#235 found the app catalogue rendering 636 items in one shot on a single-letter query. Adding row-level virtualization to ReqoreCollection (similar to `react-virtual`) would let the IDE skip its workaround for the per-render cost. Lower priority than the two above.

Acceptance criteria

  • A consumer that passes `customFilter` replaces the built-in matcher cleanly (returns false → item hidden).
  • A consumer that omits `customFilter` sees identical behaviour to today (no regression).
  • Pinned groups render in the supplied order, above the alphabetically-sorted ones; `'Ungrouped'` remains first unless explicitly overridden.
  • A story demonstrating each feature lands alongside the prop.

Context

  • IDE-side workarounds and the issues that motivated this: qorus-ide#235, qorus-ide#236, qorus-ide#237.
  • Filed by Claude on Filip's behalf while shipping the IDE fixes; assign to whoever owns Reqore's Collection component.
Lingua principale
TypeScript
Stelle
4
Fork
0
Merge medio
16h 28m
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di qoretechnologies/reqore

Tutte le issue di qoretechnologies/reqore

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.