zendesk/sunshine-conversations-web

Rerender widget in embeded mode.

Closed this issue · 3 comments

The widget is rendered in a container that can be removed from dom, and then added again.

				Smooch.init({integrationId: '...', embedded: true}).then(() => {
						this.isWidgetInited = true;
					});
					Smooch.render(document.getElementById('chat-container'));

when I leave the page with the widget container - it's removed from dom, but when I returned back and try to rerender it ( calling Smooch.render(document.getElementById('chat-container'));) - it is not displayed.

Calling init method again causes the exception '... already initialized, call destroy...', but I need to count unread messages when the user left the page, and return to the same conversation when the user returns so I can't call destroy. Do you have a valid way to handle that?

appending the container somewhere in dom roots on leaving, and inserting again on return is not helping. Iframe reloads on this action - https://stackoverflow.com/questions/8318264/how-to-move-an-iframe-in-the-dom-without-losing-its-state

Hi! Are there any updates about this bug? I have the same issue

I solved it by positioning the iframe absolutely and then my router events change the size and position of the iframe (either to be shown or to be hidden with 0/0 size and coordinates outside of the page). Works ok.