I need help with modal

8 Comentarios

  • Eric Nelson
    Zendesk Developer Advocacy

    Hey José,

    Can you provide the relevant code so that we can take a look?

    Thanks!

    Have a wonderful day!

    Eric Nelson | Manager - Developer Advocacy

    0
  • Rebecca Dai

    Eric Nelson

    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]".

    I think the instance of the modal should've been destroyed on modal closing however it seems as though there is vendor javascript that's trying to access the same modal guid and returning undefined (possibly related to rollbar?) I'm not sure how to resolve it.

    Here's some code snippets for how I set up the modal:
    https://github.com/rdai10/zendesk/blob/master/knowledge-capture-app/src/javascript/modules/SearchResults.js#L54-L78

    https://github.com/rdai10/zendesk/blob/master/knowledge-capture-app/src/javascript/modules/app.js#L37-L48

    Any feedback would be welcome, thanks!

     

    1
  • Eric Nelson
    Zendesk Developer Advocacy

    Hey Rebecca Dai,

    Am I correct that this line is the only place you're triggering the modal closing from?

    Thanks!
    Eric

    0
  • Rebecca Dai

    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!

    0
  • Eric Nelson
    Zendesk Developer Advocacy

    Hey Rebecca,

    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, 

    Eric

    0
  • Rebecca Dai

    Eric Nelson

    Thanks for taking the time to respond! My understanding is that when

    ticketSidebar.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?

    0
  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Rebecca,

    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. 
    0
  • Rebecca Dai

    Sounds good Eric Nelson, I went ahead and proceeded to create a ticket to further the conversation.

    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk