-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[RFC] Allow use of Turbolinks in admin #1863
Conversation
Super! Could you maybe push this code on a branch on the |
@mtomov is still working on this |
This is now ready to review |
@cbrunsdon rebased with latest |
@@ -0,0 +1,20 @@ | |||
// comment line necessary for correct interpolation of use_turbolinks | |||
Turbolinks.supported = <%= Spree::Backend::Config.use_turbolinks %>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead would it be possible to do by having a user edit their vendor/assets/javascripts/spree/backend/all.js
?
a1961ce
to
dbb478e
Compare
Like discussed in the last core team meeting we will ship everything that make Solidus admin compatible with Turbolinks, but do not enable it by default. Even not for newly created stores. The chance to break something by an extension or usage of JS lib that is not compatible with Turbolinks exists and we do not want to maintain issues caused by usage of Turbolinks. Use at your own risk. "It should work"™️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
cce3669
to
032589a
Compare
@cbrunsdon rewrote the flaky spec. |
Instead of using jQuery.ready we now use Spree.ready that takes care of Turbolinks load event.
Caching of Turbolinks visits causes more harm then benefits. For example we need to take care of tearing down all third party JS widgets (like select2, jQueryUI) on our own. Also lots of our JS is written in a way that it needs a fresh copy of the body to work with.
In order to enable Turbolinks in Solidus admin you need to load a fix for extensions using JS libs that make use of jQuery.ready. Add `gem 'turbolinks', '~> 5.0.0'` into your `Gemfile` (if not already present) and append these lines to `vendor/assets/spree/backend/all.js`: //= require turbolinks //= require backend/app/assets/javascripts/spree/backend/turbolinks-integration.js
This test was accessing the database inside a feature spec. Sometimes the request may not be finished yet before we ask the object for it's changed value. Rewrote the spec so it tests what's actually changing on the page instead of in the database. This should stabilize the spec.
Rebased with latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 ☠️
That was a good decision. I like it better without the config option. Thanks for all your work on that! |
Using Turbolinks for navigating admin should give us a nice little speed gain.
For getting this to work it was needed to use
Spree.ready
instead ofjQuery.ready
to initialize the various JS modules we have.Luckily
Spree.ready
already takes care of theturbolinks:load
event, so this was easy for our own admin, for extensions we overwrotejQuery.ready
to useSpree.ready
instead (the same trick thatjquery-turbolinks
uses).jQuery.ready
and log deprecation notices to the JS console