updateQueryString() (or session$updateQueryString) ultimately calls window.history.replaceState() or window.history.pushState(). However, when using shinylive the app is served as an iframe, so window in this case refers to the iframe, not the parent window. Therefore, neither of these calls works and updateQueryString() does nothing. I've found the following works instead:
shinyjs::runjs(paste0("window.parent.history.pushState(null, null, '", pushQueryString, "')"))
The MDN docs state that "If a window does not have a parent, its parent property is a reference to itself." Therefore. changing the typescript code to just use window.parent instead of window should fix this problem, regardless of whether you are using shinylive or not.
updateQueryString()(orsession$updateQueryString) ultimately callswindow.history.replaceState()orwindow.history.pushState(). However, when usingshinylivethe app is served as an iframe, sowindowin this case refers to the iframe, not the parent window. Therefore, neither of these calls works andupdateQueryString()does nothing. I've found the following works instead:The MDN docs state that "If a window does not have a parent, its parent property is a reference to itself." Therefore. changing the typescript code to just use
window.parentinstead ofwindowshould fix this problem, regardless of whether you are usingshinyliveor not.