Replies: 1 comment
|
You can use Supabase as the data source without SSR or Drizzle. Keep the table UI/hooks, and supply the rows from The important choice is where pagination happens:
A minimal remote-page fetch function is: async function fetchItems(pageIndex: number, pageSize: number) {
const from = pageIndex * pageSize;
const { data, error, count } = await supabase
.from("items")
.select("id,name", { count: "exact" })
.order("id", { ascending: true })
.range(from, from + pageSize - 1);
if (error) throw error;
return { rows: data ?? [], pageCount: Math.ceil((count ?? 0) / pageSize) };
}Replace In the current repository hook, For React Query, put page, size, sorting, and filters in the query key, then feed the returned rows/count to the table. Use your browser-safe publishable/anon key with RLS configured; don't put a service-role key in the Vite bundle. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Does anyone know of a library that integrates this with Supabase, or any implementation I could refer to for integrating it into my project?
I'm using the table from DiceUI in my Vite + React 19 project but I'm not using SSR.
Any form of help would be greatly appreciated. Thank you so much! @sadmann7
All reactions