supabase-cache-helpers icon indicating copy to clipboard operation
supabase-cache-helpers copied to clipboard

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

Open imownbey opened this issue 1 year ago • 2 comments

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 avatar Mar 17 '24 22:03 imownbey

Oops thsi should be enhancement not a bug

imownbey avatar Mar 17 '24 22:03 imownbey

always happy to accept prs! 🫶

psteinroe avatar Jul 14 '24 16:07 psteinroe