-
Notifications
You must be signed in to change notification settings - Fork 429
Track assets named 'data-turbolinks-track' #133
Conversation
This commit changes turbolinks' behavior. Track "data-turbolinks-track" assets in current page, and trigger document.reload() ONLY when clicked link page's "data-turbolinks-track"(s) differ from those of current page. Otherwise browser always uses Turbolinks#visit.
Track assets named 'data-turbolinks-track'
This still doesn't work in development if you use
As the last two requires in application.js. That seems like a lot of setup to have to remember to do to get this configured properly. |
Ryan, seems to work well here. What problem are you seeing? This change makes the order of the requires irrelevant. On Dec 4, 2012, at 4:01 PM, Ryan Ahearn wrote:
|
I currently have this order in my application.css:
And it works as expected. |
I'm still seeing the same problem as when I originally opened #118. Using your order of requires with
in the page source. When |
Ah, I'm sorry. I misunderstood. Never use config.assets.debug. Seems like we should delay the rememberCurrentTrackingAssets until the DOM is entirely loaded. Want to have a look at that? On Dec 4, 2012, at 4:20 PM, Ryan Ahearn wrote:
|
Since we're now explicitly declaring which assets to remember and thus don't have to worry about dynamically added scripts, couldn't we just wait to extract the current assets until a link is clicked? Like this? currentAssets = null
assetsChanged = (doc) ->
currentAssets ||= extractTrackAssets document
newAssets = extractTrackAssets doc
newAssets.length isnt currentAssets.length or intersection(newAssets, currentAssets).length != currentAssets.length |
That seems like a much better solution than trying to reliably do on DOM load without jQuery. |
Clever. Yes, indeed that's what we can do. Can you make a pull request for it? On Dec 4, 2012, at 5:13 PM, Nick Reed wrote:
|
Yeah, I'll submit it in a few minutes. |
@dhh:
Why? |
Implemented we've discussed in #132.
Use document#reload ONLY when
data-turbolinks-track
assets are changed, otherwise use Turbolinks#visit.