supabase-cache-helpers
supabase-cache-helpers copied to clipboard
Transformer API
Is your feature request related to a problem? Please describe.
In some cases, you might want to transform the data from PostgREST after fetching it, e.g. create a js Date
for timestamptz
columns, or convert the snake case to camel case (#244)
Describe the solution you'd like
Add a transformer API to all query hooks, that accepts a transformer: (result: R) => TransformedResult
method. The transformer is applied within the fetcher, and before the data is written to the cache. It also transforms the Result
type to ensure type-safety.
Describe alternatives you've considered Wrapping the hooks and transform them afterwards.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This is one of the first features that I was looking for. Simple use case: parse Dates.