appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Bug]: Widget is visble in view mode even when evaluated value of the "Visible" property is false

Open shadabbuchh opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

A widget is visible in the view mode even when binding with a Modal widget is done in such a way such that if the Modal widget is visible, then only the other widget should be visible.

Steps To Reproduce

  1. D&D a button & a Modal widget.
  2. Now configure the Visible property of the Button widget as: {{Modal1.isVisible}}.
  3. Deploy the app.
  4. The button widget will be visible by default for the first time on view mode.

Expected: The button widget shuld not be visible in the view mode for the first time also

Public Sample App

No response

Environment

Production

Issue video log

https://www.loom.com/share/7a533d184ce343a7a6a9ba62f2d7714b

Version

Cloud

shadabbuchh avatar Apr 24 '23 12:04 shadabbuchh

This is happening because when the page loads the modal isVisible property is undefined. Maybe it does not have a default value. @keyurparalkar do you know what can be the implications of setting a default value on this prop

Screenshot 2023-04-26 at 12 09 40 PM

cc @rajatagrawal

somangshu avatar Apr 26 '23 06:04 somangshu

@somangshu if the value is set to undefined then shouldn't it come as false?

dilippitchika avatar May 11 '23 13:05 dilippitchika

@dilippitchika the value right now if undefined after the eval cycle. Since our output is undefined the issue occurs. undefined and false are different type / value.

Both undefined and null are falsy by default. So == returns true. But when we use the strict equality operator (===) which checks both type and value, it returns false

somangshu avatar May 16 '23 13:05 somangshu