Skip to content
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: use drop valueOf when evaluated as solitary condition #705

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

admtnnr
Copy link
Contributor

@admtnnr admtnnr commented Jun 4, 2024

Context

I noticed an inconsistency with drops where a drop's value will go through normal value resolution if used in an expression like if drop > 10, but it does not if the drop is the only part of the expression like if drop which causes it to always evaluate as truthy (because it's an object).

Shopify's Liquid implementation doesn't seem to support functionality similar to that of valueOf that we have in Liquid.js, so there's not prior art we can rely on there. Given if does seem to call valueOf when used with some type of operator I opted to make the bare drop case consistent with the existing behavior.

@admtnnr admtnnr marked this pull request as draft June 4, 2024 20:24
@admtnnr admtnnr force-pushed the fix/drop-condition-variable branch from 5db8a2b to f67e145 Compare June 4, 2024 20:31
@admtnnr admtnnr marked this pull request as ready for review June 4, 2024 20:32
@admtnnr admtnnr force-pushed the fix/drop-condition-variable branch from f67e145 to f63a690 Compare June 4, 2024 20:33
@harttle harttle merged commit a7da93f into harttle:master Jun 5, 2024
11 checks passed
@harttle
Copy link
Owner

harttle commented Jun 5, 2024

@all-contributors please add @admtnnr for code

Copy link
Contributor

@harttle

@admtnnr already contributed before to code

@admtnnr admtnnr deleted the fix/drop-condition-variable branch June 5, 2024 00:32
github-actions bot pushed a commit that referenced this pull request Jun 17, 2024
# [10.14.0](v10.13.1...v10.14.0) (2024-06-17)

### Bug Fixes

* use drop `valueOf` when evaluated as condition ([#705](#705)) ([a7da93f](a7da93f))

### Features

* support catching all errors, [#220](#220) ([#710](#710)) ([3b5627b](3b5627b))
Copy link

🎉 This PR is included in version 10.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants