craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.23k stars 630 forks source link

[5.x]: Float numbers in GraphQL weird behaviour #15222

Closed ishetnogferre closed 3 months ago

ishetnogferre commented 3 months ago

What happened?

Description

We're using the number fields to store longitude and latitude because we only need these values. In the front-end we us GraphQL to query between two numbers.

Steps to reproduce

  1. Have a Numbers field, set to 16-20 decimals
  2. Query the exact number
  3. Query between 2 numbers with decimals

Expected behavior

In case 2: have the exact entry returned In case 3: have the entry and others returned

Actual behavior

  1. When using the exact number, an error show we can only use string, integer or boolean. Screenshot 2024-06-18 at 10 29 27

    Screenshot 2024-06-18 at 10 29 20
  2. When using a simple comparison (>= or <=), it show the correct entry and more

    Screenshot 2024-06-18 at 10 30 47
  3. When using a range, it shows none

    Screenshot 2024-06-18 at 10 30 58

Extra Don't know if this is expected behaviour but the filter input doesn't incorporate the decimal setting from the Number field.

Screenshot 2024-06-18 at 10 39 56

Craft CMS version

Craft 5.2.0

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

-

brandonkelly commented 3 months ago

Thanks for reporting those! Craft 4.10.2 and 5.2.2 are out with a fix for the condition rule bug (6b370d3ca6723beeb2865e572b7f5ea3cba9443c) and 5.2.2 also includes a fix for the query param handling (#15227).