Forum Discussion
Custom Visuals format panel input values reset 1 second after text entry: update() not called?
Next step of the saga:
- if a Report editor manually edits the Fields panel, that triggers `update()`
- ... and then Format `update()`s start working as well
This is not intuitive behavior so far
- dm-p4 years agoSuper User
Hi lmeyerov,
If a user updates properties or field/data mappings, this triggers the update() method as your visual potentially receives new data from the main window, so this is your entry point for managing such changes - read this page in the visuals documentation in order to understand what happens with events from users, the main window and your visual, and which methods are called (or how you need to invoke them).
When a user modifies a property, the update method will be called by the main window, so if changes are being reverted in the pane to a default value then this suggest it's not able to run to completion or there is an issue with property enumeration and Power BI is assigning the default value back.
It's not easy to tell from your code if/what this is, as you only provided partial segments of your methods - and from the first line of the update method you have posted, this would fail as I can't see config declared anywhere that's in scope - I'm sure this is not actually the case and you probably have more code to manage this.
Have you ruled out any potential errors in your code to begin with, i.e. even using a try...catch block around the update method's code and logging the output? If in doubt you can add a console.log as the very first statement in your update method (before the property enumeration) to confirm it's being fired by the main window when the property is edited - it should be, and from your snippet, this isn't here for me to verify, although you mention it in your original post.
If you can trap some more specific detail regarding error output then we can see where to go from here. Failing that, you may need to provide more of your current code; ideally a clonable repo so it's easier to check-out and reproduce locally.
Regards,
Daniel