-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix: Properly handle object properties on Query Compiler #413
Fix: Properly handle object properties on Query Compiler #413
Conversation
🦋 Changeset detectedLatest commit: d33e41c The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
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 |
Since now we can do some things like In the case of |
b98a332
to
b2fee7f
Compare
I agree on supporting object properties on param() calls but I don't understand why it means we need to allow param returning undefined. |
expect(result).toBe('$[[val]]') | ||
}) | ||
|
||
it('allows optional chaining operator', async () => { |
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.
why do we allow it here but not here
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.
Because you can't do undefined = 3
. That's something internal in the compiler, can't even change it. Anyways, that does not work in regular javascript either.
b2fee7f
to
d33e41c
Compare
Describe your changes
Compiler did not properly handle object properties. Before this commit, you could not:
?.
)Invoke object properties as methods
Some variable types can contain functions that may be useful in the query compilation run-time. A clear example is Dates, where a Date can be passed to a query as a param, and we may want to run date-related methods.
Modify object properties as methods
You can now also modify the value from object properties such as arrays and hashes.
Allow optional chaining operator (
?.
)The optional chaining operator allows you to read the value of a property located deep within a chain of connected objects without having to expressly validate that each reference in the chain is valid.
Checklist before requesting a review