GithubHelp home page GithubHelp logo

Comments (3)

vigliag avatar vigliag commented on June 25, 2024

This is a javascript problem, and causes this error:
google.charts.load() cannot be called more than once with version 45 or earlier.
which happens because of turbolinks https://github.com/turbolinks/turbolinks .

Turbolinks is a method to make pages load faster by making ajax requests and replacing the body of the page. This way the browser doesn't have to reload the

and the tag.
Because of Turbolinks we are effectively always on the same page (home) and the others are loaded via js. This means that we start in home, the google charts js gets executed the first time, and remains in ram, so that when we visit the page again, the body is re-executed, but it finds the google charts library already loaded and complains.
The solutions are:

  • moving that code (or at least the google.charts.load() part) in a tag in the header (which isn't re-executed because it is only loaded once). Note that the chart, instead, should be redrawn on every visit. This means we should have some part of the code either in a 'script' tag in the body or wrapped in a turbolinks:load event listener. This may be tricky.
  • disabling turbolinks altogether (which we can very well do, especially because we are not so concerned with performances right now)

from isamuni.

sic2 avatar sic2 commented on June 25, 2024

I get that!

On one hand: yes, lets disable turbolinks! But I do not want to make the webapp too slow. One think is having the app tested locally, but once deployed I would not be surprised to see event 30-50+ people there at the same time (expecially on day-0). Not big numbers, but who knows...

Can't we have the js code in the layout.js file?

Note that the chart, instead, should be redrawn on every visit.
The onLoad() function will not work I guess, but rails might have something for us. I will look for that.

from isamuni.

sic2 avatar sic2 commented on June 25, 2024

Solved with commit:
fd97e72

from isamuni.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.