juba / robservable

Observable notebooks as R htmlwidgets
https://juba.github.io/robservable/
163 stars 11 forks source link

Conflict when both robservable and {ojs} used in .qmd #52

Closed allisonhorst closed 1 year ago

allisonhorst commented 1 year ago

Hello, and thank you for making such a useful package.

I noticed while making examples of different ways to access content from Observable notebooks and work in {ojs} cells in a Quarto document that the output is unpredictable (sometimes errors, sometimes works perfectly, errors change unpredictably, etc.).

Moving the robservable example into its own .qmd without any {ojs} cells fixed it. My coworker Fabian pointed me in the right direction for a fix: "it seems to me that robservable conflicts with the quarto-ojs-runtime because they both package d3-require." I wonder if there's a way to update so that both are possible?

Thanks again for all of your work on this package, it's really nice!

juba commented 1 year ago

Hi !

Thanks for taking the time to report the issue, I never tried to use robservable in a quarto document.

I tried to reproduce the problem here but failed. So I was wondering if you tried with the development version of robservable, and if the problem is still there if you would have a sample quarto document with the issue ?

Thanks again !

allisonhorst commented 1 year ago

Sure thing! I think I'm trying a pretty niche case (where I was using both robservable and {ojs} cells in .qmd), so I don't expect this to be an at all common issue.

I had posted in the Quarto discussion board before sharing here, here's the link to that chat in case it's useful: https://github.com/quarto-dev/quarto-cli/discussions/5344

Thank you!

juba commented 1 year ago

Hi,

Thanks for the link to the quarto discussion and your Github repository I've been able to reproduce the issue. There indeed seems to be a conflict between runtimes and a sort of race condition that makes either robservable or ojs cells fail depending on how things are loaded.

Unfortunately I don't see how I could fix this from robservable side. So for now, as it may not be a very common use case I think I'll just add a warning in the documentation.

Thanks again for taking the time to report the issue.

allisonhorst commented 1 year ago

That sounds great, I think a note in the documentation works fine for this niche scenario. Thank you!