-
Notifications
You must be signed in to change notification settings - Fork 898
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
Tree-shakeable FieldFilter #3252
Conversation
Binary Size ReportAffected SDKs
Test Logs |
Could you explain how this results in any net savings for users? AFAICT, you've changed this from a set of classes with polymorphic behavior to a big if-then ladder, but so long as you run queries at all, you still get all the code. There's been a very slight savings in package size at a massive cost in readability and maintainability. FWIW, the other kind of filter we had mind were conjunctions and disjunctions. |
🦋 Changeset is good to goLatest commit: 9a26ff6 We got this. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 |
Sorry, I missed your comment. The idea was to make both |
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.
Added back the FieldFilter classes, but they only support matches()
. canonifyFilter
, filterEquals
and stringifyFilter
are the remaining size savings (that will only come into play once Query is updated as well).
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.
Basically LGTM with a style question.
OrderBy, | ||
orderByEquals, | ||
stringifyOrderBy | ||
stringifyOrderBy, |
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 we've discussed this before, so I won't push, but I find the difference in ordering (subject-operation vs operation-subject) between orderByEquals
and stringifyOrderBy
to be jarring. Autocompletion and muscle memory would be much easier if there was just one way to do it.
If these were all in the form subject-operation they would group nicely in imports as well.
What do you think of these?
orderByEquals
orderByToString
orderByCanonicalId
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.
The naming in this PR is inspired by the names in the Values helper. I am also not a big fan how "equals" is an outlier, but on its own I do think that each name looks ok. For that reason, I am kind of reluctant to change it right now, but I am not opposed to overhauling all stringify/canonicalize methods in a follow up.
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.
LGTM
This PR makes the Proto-consuming code in FieldFilter tree-shakeable. Once this is merged, we can make Query tree-shakeable.