Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turbo_frame_tag update affecting Chartkick outside the frame #416

Closed
philsmy opened this issue Jan 3, 2023 · 2 comments
Closed

turbo_frame_tag update affecting Chartkick outside the frame #416

philsmy opened this issue Jan 3, 2023 · 2 comments

Comments

@philsmy
Copy link

philsmy commented Jan 3, 2023

Sorry, not quite sure how to word the title. But essentially:

A Rails 7.0.4 demp app (using the latest turbo-rails) with a very simple model and index page that contains the list of objects inside the turbo_frame_tag. There is a Chartkick chart outside the frame in another part of the page.
Refreshing doing a form-driven update of the turbo frame causes the Chart to lose its content.

It is exactly the same as described in issue #125 (which was closed almost 2 years ago).

I have a repository here that shows the error: https://github.com/philsmy/hotwire_demo

@BroiSatse
Copy link

@philsmy Just encounter very similar issue. After some digging in, it seems that chartkick is listening to turbo:before-render hook and calling Chartkick.destroyAll(). This will affect all the charts, even the ones outside of the frame.

What's more, recent changes caused inline script tags to execute before turbo:before-render, meaning that graphs inside the frame are destroyed as soon as they're created - I will raise another issue for this one.

Anyway, there's an option to disable autoDestroy with Chartkick.config.autoDestroy = false, but you'd need to handle destroying deleted graphs by yourself.

@brunoprietog
Copy link
Contributor

Closing this since it's a Chartkick issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants