Closed chlebowa closed 2 weeks ago
Thanks for the PR @chlebowa the JS code seems equivalent.
Can you share a simple reproducible example?
I've tried to create an example to understand the issue but couldn't.
My attempt using {teal.modules.general}
scatterplot and a custom module: (screencast at the end)
I am unable to provide a screencast but here is an example app.
Generate an app, go back to configuration, then generate the same app again, and try clicking the hamburger button.
This one uses insertUI/removeUI
to replace teal
apps. I have another one that uses renderUI
and it works pretty much the same (both problem and solution).
Hey @chlebowa something is off with one of the tests https://github.com/insightsengineering/teal/actions/runs/9566206096/job/26373606743?pr=1239#step:41:152
It is but I am having trouble running that one locally. I will try again.
@m7pr done
It seems that as soon as the teal UI is removed $(window).trigger("resize")
starts to give out errors.
Edit: There's one error with the re-declaration of const
of the JS functions
However, even if this is resolved, the resize
event will always fail (just as resizing the window)
This is a problem with the example though, so I guess we can merge this PR as it improves the JS code.
plots no longer resize
It seems that as soon as the teal UI is removed
$(window).trigger("resize")
starts to give out errors.
Yes, I've seen that but I decided it's something I can live with or perhaps solve later.
Edit: There's one error with the re-declaration of
const
of the JS functions
I only see the clientWidth
error. In any case, re-declarations fail and the consts stay in place, so the whole script works as expected. That is also something I can live with.
Thank you, I applied your suggestions.
@averissimo you need to merge, as @chlebowa does not have priviledges :)
BACKGROUND
I am trying to embed a
teal
app in ashiny
app (shiny
is parent andteal
is child). I want to be able to go back and forth between configuring theteal
app and inspecting it.The
teal
app is created by callingmodule_teal_with_splash
, withui_teal_with_splash
placed in arenderUI
call andshinyjs::hidden
. When configutraion is ready, an action button runsshonyjs::show
on the module UI and calls the module server function. When the user wants to go back to configuration, the child app is hidden again. A new child is run with a different, incremented id.PROBLEM
I am having some trouble with the filter panel that results from the current implementation of
showSidebar
andhideSidebar
.Over a single session of the parent app, when the child is rendered for the first time, the filter panel can be toggled normally. However, when I generate the child app for the second time, the JS console throws an error and toggling is no longer possible. The filter panel is expanded but invisible because it retains
display: none
.NOTE
The bug is only triggered by modules that contain plots. Modules with tables or simple prints (like
example_module
ortm_t_crosstable
) work just fine but once the bug is triggerred, those too are affected.SOLUTION
I modified the script that toggles the filter panel to get around the issue.
resize
method throws an error (even thought the resizing does occur) soshowSidebar
exits early andfadeIn
does not kick in. I movedresize
to the end of the function.$(".teal_secondary_col").fadeIn(50)
and$(".teal_primary_col").resize()
that prevents resizing. I replacedfadeOut/In
with changing thedisplay
tonone/block
, respectively, and usedsetTimeout
becausedelay
didn't seem to work.