appsmith: [Enhancement]: Don't create the modal when it is not shown thus avoiding errors it may have on page load

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Edit mode: the modal throws error on page load. Even though it’s closed.

Conditions:

  1. When the modal has certain fields that are bound to a widget on page.
  2. And when the widget depends on some dynamic data (that gets populated on certain action, which is not performed yet).

Steps To Reproduce

App export for reference.

  1. Create an API that returns an array of objects.
  2. Create a button that triggers the API -> onClick.
  3. Bind API.data to a table.
  4. Create a modal and inside that, create an input field that binds defaultText to Table.selectedRow.columnName.
  5. Make sure Run API on Page load is disabled.
  6. Refresh the page and notice an error in appsmith console from modal. image

Yes, we could add a null check to solve this. But, a question arises. Should modal contents be evaluated even when it’s not open?

Notice the error gets resolved, the moment we click on the button.

Environment

Production

Version

Cloud

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 20 (13 by maintainers)

Most upvoted comments

@eco-monk I think this is more an enhancement than a bug. The widgets are always created and only hidden / shown since they are part of the DSL. This can be an optimization