SolidJSS
SolidJSβ€’2y agoβ€’
9 replies
ChrisThornham

revalidate() Not Working As Expected

I'm fetching data from Supabase and using their Realtime feature so I can see live updates.

To do that I'm using cache(), createAsync(), and revalidate()

It looks like this:

cache function:
const getNotes = cache(async () => {
  "use server";
  // get data
  const { data } = await supabase.from("notes").select();
  // return data
  return data;
}, "notes");


createAsync function:
const notes = createAsync(() => getNotes());


Here's where I'm confused. revalidate() works no matter what value I pass it.

So all of these options will revalidate the notes Signal from createAsync.
1. revalidate()
2. revalidate("notes")
3. revalidate("some random string")

I only expected option #2 to work. What am I missing?

Thanks,

Chris
Was this page helpful?