You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
First, thank you for this great project.
If a query contains gte or lte filters, it's unclear that one should use revalidate: true in the config to cause the cache to revalidate. This makes sense that advanced logic like comparing date ranges would not be processable locally, but .eq and other filters will work without revalidate: true.
To Reproduce
const { data } = useQuery(
supabase.from('habit_tracking')
.select('id, timestamp, habit_goal_id')
.eq('habit_goal_id', id)
.gte('timestamp', firstDateVisible?.toISODate())
.lte('timestamp', lastDateVisible?.toISODate())
,
{
revalidateOnFocus: false,
revalidateOnReconnect: false,
}
);
console.log(data);
const { trigger: insert } = useInsertMutation(
supabase.from('habit_tracking'),
['id'],
'id, timestamp, habit_goal_id',
{
onSuccess: () => console.log('fired insert mutation on habit tracking!'),
// Required for gte and lte in query
revalidate: true, // If gte & lte filters removed, the cached query is returned with all data
},
To insert
await insert([{
timestamp: date.toISO(),
habit_goal_id: id
}]);
Describe the bug
First, thank you for this great project.
If a query contains
gte
orlte
filters, it's unclear that one should userevalidate: true
in the config to cause the cache to revalidate. This makes sense that advanced logic like comparing date ranges would not be processable locally, but.eq
and other filters will work withoutrevalidate: true
.To Reproduce
To insert
Expected behavior
Add documentation on what query filters work without
revalidate: true
in https://github.com/psteinroe/supabase-cache-helpers/blob/main/docs/pages/postgrest/mutations.mdxAdditional context
Wanted to make sure this is expected behaviour before filing PR.
The text was updated successfully, but these errors were encountered: