I need help with modal
I have a problem when creating the modal, the service does it well, it brings me the data of the side bar well, but when closing the modal it gives an error cannot access instance and I don't know why
Can you provide the relevant code so that we can take a look?
Have a wonderful day!
Eric Nelson | Manager - Developer Advocacy
I ran into the same issue. I was able to create a modal and populate it with the desired content. However, after I close the current modal and open a new modal, a yellow dot appears in the app. Hovering over the dot, as well as observing the browser console, I will see the error "Cannot access instance [guid of previous modal]".
Here's some code snippets for how I set up the modal:
Any feedback would be welcome, thanks!
Hey Rebecca Dai,
Am I correct that this line is the only place you're triggering the modal closing from?
Hey Eric Nelson,
Sorry I didn't see your response until now!
Yes, presently it is the only place where I'm manually triggering modal destroy. However, I believe destroy should've been called under the hood when the x button on the modal is clicked. Let me know if that assumption is incorrect.
Previously, I have tried invoking the destroy when the 'modal.close' event is called in modal creation (here) and also in the modal instance itself (here). I observe the same error with and without these code there. Please let me know if I didn't set up correctly. Thanks!
So sorry for the lack of response. Seems your post got lost in the shuffle to our new community. I've spent some time debugging this issue this morning and it seems to be an issue with the way your app is utilizing the context provider (located in the Global.js file). You can see this by logging the props to the console:
It looks like you are expecting the context that you're passing it to reset upon modal close or dynamically, though you don't have anything triggering that so it's just adding on the existing props. If you were to clear the context on the 'modal.close' event, it should resolve your issue.
Hope this helps,
Thanks for taking the time to respond! My understanding is that whenticketSidebar.instance(modal.instanceGuid)
is called, a new instanceClient is added to the ticketSidebar client. So every time a new modal is opened, the instanceClient object grows larger if not properly removed.
While looking at the ZAF client API docs, the only clean up relating to removing the instance of the modal is through calling destroy. However, as mentioned in a previous comment, invoking it manually doesn't seem to remove the obsolete instanceClients on the ticketSidebar client. Is there an idiomatic way to achieve this? Or perhaps areas on the doc that you can point me to?
Apologies! It seems that there is something going on with me receiving notifications for this thread. Do you mind if we pull this into a ticket to continue this conversation? In the interim, I'm testing out some different possible solutions for clearing out the instancecClient from the ticketSidebar.
Sounds good Eric Nelson, I went ahead and proceeded to create a ticket to further the conversation.
댓글을 남기려면 로그인하세요.