-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(supabase): add support for between in dataProvider. maps values to gte & lte. #6206
Conversation
🦋 Changeset detectedLatest commit: c2fd818 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Sergio16T thank you for the quick PR! Looks great, I just left two small comments, let me know if you can work on those 🙏 I'm hoping to include this in our next release this week 🚀
@@ -39,7 +39,26 @@ export const dataProvider = ( | |||
}); | |||
|
|||
filters?.map((item) => { | |||
generateFilter(item, query); | |||
if (item.operator === "between") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think moving this to generateFilter
(packages/supabase/src/utils/generateFilter.ts) will be better for consistency.
{ | ||
field: item.field, | ||
operator: "gte", | ||
value: item.value[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can we add a small condition to check item.value
is an array with length of 2 and if not throw an error 🤔
…er value length error
Hi @aliemir thank you for the feedback to PR! I've updated the PR with the requested changes 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update @Sergio16T! 🚀
Bugs / Features
What is the current behavior?
Current Supabase data provider does not support between date ranges.
When providing an initial filter with a between operator to useTable Hook an error occurs.
What is the new behavior?
Supabase data provider will now map
between
date ranges from the values array to gte & lte accordingly adding support forbetween
to Supabase data provider.feat #6119