فهرست منبع

fix(ui): track memo-based items in useFilteredList without affecting async function based lists (#8216)

Co-authored-by: neriousy <[email protected]>
OpeOginni 1 ماه پیش
والد
کامیت
736cd10847
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      packages/ui/src/hooks/use-filtered-list.tsx

+ 5 - 1
packages/ui/src/hooks/use-filtered-list.tsx

@@ -24,7 +24,11 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
   const [grouped, { refetch }] = createResource(
     () => ({
       filter: store.filter,
-      items: typeof props.items === "function" ? undefined : props.items,
+      items: typeof props.items === "function"
+        ? props.items.length === 0
+          ? (props.items as () => T[])()
+          : undefined
+        : props.items,
     }),
     async ({ filter, items }) => {
       const needle = filter?.toLowerCase()