psteinroe / supabase-cache-helpers

A collection of framework specific Cache utilities for working with Supabase.
https://supabase-cache-helpers.vercel.app
MIT License
452 stars 24 forks source link

No obvious types for passing fallback data from server component to client component #414

Open imownbey opened 6 months ago

imownbey commented 6 months ago

Describe the bug I am trying to type the result of fetchOffsetPaginationHasMoreFallbackData to pass it to a client component where it then gets passed as fallbackData. The closest I have found is:

type Result = Awaited<ReturnType<typeof recentBranchesQuery>> extends PostgrestResponseSuccess<infer T> ? T : never;

type Props = {
    fallbackData: {
        data: Result;
        hasMore: boolean;
    }[];
};

But I am not totally sure if this is actually correct, and it would be nice to include some helper types to do something similar? I am happy to open a PR with them. To Reproduce If possible, open a PR with a failing test. Otherwise, describe how to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.

imownbey commented 6 months ago

Oops thsi should be enhancement not a bug

psteinroe commented 2 months ago

always happy to accept prs! 🫶