@kahitsan/ksui 0.51.0-solid2.0 → 0.51.0-solid2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kahitsan/ksui",
3
- "version": "0.51.0-solid2.0",
3
+ "version": "0.51.0-solid2.1",
4
4
  "description": "Standalone SolidJS UI components with original owned icon artwork. Ships source for the consumer compiler and has no runtime dependency beyond solid-js.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -213,6 +213,8 @@ export interface DataTableProps<T extends DataTableRow> {
213
213
  /**
214
214
  * Reactive key that triggers a refetch + page-1 reset when it changes.
215
215
  * Typical usage: `refetchKey={() => activeWorkspace()?.ws_id}`.
216
+ * `fetchFn` runs untracked, so any signal it reads (an external filter, say)
217
+ * must also be read in this key, or changing it will not refetch.
216
218
  */
217
219
  refetchKey?: () => unknown;
218
220
 
@@ -173,3 +173,23 @@ describe("ResourcePage permission gates and mutation failures", () => {
173
173
  expect(await screen.findByText("PATCH failed visibly")).toBeTruthy();
174
174
  });
175
175
  });
176
+
177
+ describe("ResourcePage filters", () => {
178
+ // The table fetches untracked, so a filter change must refetch through the key.
179
+ it("refetches with the new value when a segmented filter changes", async () => {
180
+ const spec: ResourceUiSpec = {
181
+ ...SPEC,
182
+ filters: [
183
+ { type: "segmented", param: "state", options: ["active", "archived"], default: "active", testIdPrefix: "resources-state" },
184
+ ],
185
+ };
186
+ const fetchImpl = fetchFor([ACTIVE]);
187
+ render(() => <ResourcePage spec={spec} host={host(() => true)} fetchImpl={fetchImpl} />);
188
+ await screen.findByText(ACTIVE.name as string);
189
+ expect(fetchImpl).toHaveBeenCalledWith(expect.stringContaining("state=active"), expect.anything());
190
+ fireEvent.click(screen.getByTestId("resources-state-archived"));
191
+ await vi.waitFor(() =>
192
+ expect(fetchImpl).toHaveBeenCalledWith(expect.stringContaining("state=archived"), expect.anything()),
193
+ );
194
+ });
195
+ });
@@ -300,7 +300,8 @@ export function ResourcePage<T extends ResourceRow>(
300
300
  }
301
301
  >
302
302
  <DataTable<ResourceRow>
303
- refetchKey={refetchKey}
303
+ // The table runs fetchFn untracked, so filter changes must be part of the key.
304
+ refetchKey={() => `${String(refetchKey?.())}|${JSON.stringify(filterState)}`}
304
305
  fetchFn={async (
305
306
  params: FetchParams
306
307
  ): Promise<FetchResult<ResourceRow>> => {