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:
- When the modal has certain fields that are bound to a widget on page.
- 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.
- Create an
API
that returns an array of objects. - Create a button that triggers the
API
->onClick
. - Bind
API.data
to atable
. - Create a
modal
and inside that, create aninput field
that bindsdefaultText
toTable.selectedRow.columnName
. - Make sure
Run API on Page load
is disabled. - Refresh the page and notice an error in appsmith console from modal.
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)
@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