Skip to content

Supabase with React Streaming #7197

Closed Answered by CripyIce
CripyIce asked this question in Q&A
Discussion options

You must be logged in to vote

Finally managed to make it work with the following code:

import { defer, type LoaderArgs } from "@remix-run/cloudflare";
import { Await, useLoaderData } from "@remix-run/react";
import type { PostgrestSingleResponse } from "@supabase/supabase-js";
import type { Tables } from "database.types";
import { Suspense } from "react";
import { createServerClient } from "~/lib/utils";

export const loader = async ({ request, context }: LoaderArgs) => {
  const response = new Response();
  const supabaseClient = createServerClient({ request, response, context });

  const appsPromise = supabaseClient.from("apps").select();

  return defer({ apps: appsPromise.then() });
};

export default function Te…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MichaelDeBoey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant