Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

(maint) only add chart if it's not there #199

Closed
wants to merge 1 commit into from

Conversation

jeffweiss
Copy link
Contributor

Prior to this commit, Dashboard would experience a weird bug where
the charts would intermittantly show up twice. This commit adds a simple
exists? check and only adds the charts if they are not already in the
DOM.

Prior to this commit, Dashboard would experience a weird bug where
the charts would intermittantly show up twice. This commit adds a simple
exists? check and only adds the charts if they are not already in the
DOM.
@puppetcla
Copy link

CLA Signed by jeffweiss on 2012-01-27 21:00:00 -0800

@sodabrew
Copy link
Owner

sodabrew commented Apr 6, 2013

Was this always the case, or did it begin with the new jqPlot code? Could there be a fix to the root cause?

@jeffweiss
Copy link
Contributor Author

I don't know. I also didn't see it for several days of using @fhrbek's charting. Then, when it came time for me to give a demo, it showed up and wouldn't go away, irrespective of development or production modes or asset precompilation. I also tried checkin out fresh copy of repo. Stepping through JavaScript only added it once, but when nothing was left to step through, a second magically appeared. JavaScript is definitely not my forte, so there might be a more elegant solution.

@sodabrew
Copy link
Owner

sodabrew commented Apr 9, 2013

I found that if I run rake assets:precompile, I get double charts.

@jeffweiss
Copy link
Contributor Author

Cool. Glad it's not just me. :)

@sodabrew
Copy link
Owner

sodabrew commented Apr 9, 2013

Yep, it's definitely the assets:precompile. Basically if you have both of these settings, you'll get the individual uncompressed JS and CSS files, as well as the coalesced and minified versions:

  config.assets.compile = true
  config.serve_static_assets = true

There's a small headache that because we do have assets in public/ that need to be served in dev mode, we cannot simply switch off serve_static_assets in config/environments/development.rb. I don't see an obvious setting like "don't link to public/application.js in dev mode".

@sodabrew
Copy link
Owner

sodabrew commented Apr 9, 2013

The epic saga starts at rails/rails#6421

My suggestion is to close this PR with a mental note that in dev mode, run bundle exec rake assets:clean after testing bundle exec rake assets:precompile.

@jeffweiss
Copy link
Contributor Author

Noted. Thanks.

@jeffweiss jeffweiss closed this Apr 9, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants