PalmyraLookupStore#
@palmyralabs/palmyra-wire · PalmyraLookupStore implements LookupStore<any>
Overview#
Minimal query-only store — intended for autocomplete, dropdown, and picker lookups where the UI just needs a filtered list and nothing else. Same wire format as the grid store but with a smaller surface.
Obtain via factory.getLookupStore(...).
Constructor#
new PalmyraLookupStore(
baseUrl: string,
endPoint: IEndPoint,
options: StoreOptions,
factory?: APIErrorHandlerFactory,
idProperty?: strings,
)Methods#
| Method | Signature |
|---|---|
query |
query(request: QueryRequest): Promise<QueryResponse<any>> — same GET pattern as grid; returns the full QueryResponse (result + total) |
getClient |
inherited — direct axios access when needed |
Example#
Debounced autocomplete against a master-data endpoint:
import { useMemo, useState } from 'react';
import { Autocomplete } from '@mantine/core';
import { useDebouncedValue } from '@mantine/hooks';
import AppStoreFactory from './wire/StoreFactory';
export function ManufacturerPicker({ value, onChange }: { value?: number; onChange: (id: number) => void }) {
const store = useMemo(
() => AppStoreFactory.getLookupStore({}, '/mstManufacturer', 'id'),
[]
);
const [search, setSearch] = useState('');
const [debounced] = useDebouncedValue(search, 250);
const [options, setOptions] = useState<{ value: string; label: string }[]>([]);
useEffect(() => {
let cancelled = false;
store.query({ filter: { name: debounced }, limit: 20 }).then(r => {
if (cancelled) return;
setOptions(r.result.map((m: any) => ({ value: String(m.id), label: m.name })));
});
return () => { cancelled = true; };
}, [debounced]);
return (
<Autocomplete
value={search}
data={options}
onChange={setSearch}
onOptionSubmit={id => onChange(Number(id))}
/>
);
}