Giter Club home page Giter Club logo

Comments (6)

duydvu avatar duydvu commented on May 28, 2024

Can you give an example to reproduce this bug?

from directus-extension-computed-interface.

Guiqft avatar Guiqft commented on May 28, 2024

Here is a GIF showing the bug:
ezgif-5-e3eb47a73b

I think that the computed value must emit a null if the source value is null.

from directus-extension-computed-interface.

Guiqft avatar Guiqft commented on May 28, 2024

We also have this:
ezgif-1-5736797894
I put these logs on interface.vue:63. Seems that the other computed field emitted a 0, his expression is simple: {{ MULTIPLY(numero,2) }}.
I think we must check if the source value is null before parse the expression.

from directus-extension-computed-interface.

Guiqft avatar Guiqft commented on May 28, 2024

@duydvu to reproduce this, you can create these fields:

  • number (numeric)
  • numberx2 ({{ MULTIPLY(number, 2) }}
  • text (string)
  • text_slug ({{ SLUG(text) }}

When you edit the text field but leaves number empty and tries to save the item, the numberx2 calculation is triggered and returns 0 (because number(null) x 2 = 0. Then, Directus complains about you trying to get out from a item that has unsaved changes.

from directus-extension-computed-interface.

duydvu avatar duydvu commented on May 28, 2024

Nope, still can't see the bugs. Which Directus version are you using? Mine is 9.10.0

from directus-extension-computed-interface.

Guiqft avatar Guiqft commented on May 28, 2024

Hi @duydvu! Sorry for the long time.
I can still reproduces this on a empty instance of Directus 10.5.3.
In the most basic example:

  • Create a INT field my_number with simple input
  • Create a INT field my_number_x2 with the computed extension {{ MULTIPLY(my_number, 2) }}

When typing any number then erasing on the source input, the computed input gives me 0 as result, but I think it should be null.

If the source is a empty value, the computed should be empty too.
This is the same cause that makes the computed field starts with 0 on the video below ("Compute If Empty" is enabled).

Screen.Recording.2023-08-21.at.17.26.21.mov

from directus-extension-computed-interface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.