Issue with shinyjs in a golem application

I have an issue with trying to extend shinyjs in a golem application.
I've managed to make things work under certain conditions but even when it works, there's some errors/warnings in the JS console.

When including a shinyjs extension function as text, it works with a warning.
When including an extension as an external JS file, it doesn't work per the shinyjs docs.
However, if I wrap the function, in the external JS file, in $( document ).ready(function() {...}); it works, again with an error.

I think the issue is related to the order in which resources are loaded.
The JS file tries to load before shinyjs and so JS throws an error about shinyjs not being defined. Then shinyjs loads, followed by the JS file, and then it works.
At least, that is what I think is going on.

I'm curious if anyone can help figure out what is going on and resolve the errors.

I've made a reprex that can be found here

The only thing I'd add is that the js file is loading, and the app does work, but you still see a cannot load resource error in the browser console. We tried putting the shinyjs code prior to the call to bundle_resources but still get the error. Does anyone know why we see this error, despite the app working and the file being brought in?

1 Like

Hey,

Could you open a question here on the {golem} repo?

I'll have a look into that soon :slight_smile:

Thanks,
Colin

1 Like

Thanks Colin! I've created an issue on GitHub

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.