Created by @jahudka in Releases
@jahudka
@jahudka

Fixes a bug in SnippetAgent which made snippet setup callbacks run too early to see the new page's URL.

This is a weird situation: this behaviour is actually correct from one point of view (snippet setups should run all together after transaction is completed), but unintended (it only works because the snippet setup callbacks are called in a requestAnimationFrame() callback). The after-update event, which is emitted synchronously just before the call to requestAnimationFrame(), always occurs before a new entry is pushed onto the history stack, so in after-update you always get the old page URL, whereas in snippets' setup callbacks you get the new URL, even though after-update and snippets' setup are logically the same injection point in the app's lifecycle.

In the future I'd like to normalize this behaviour so that the page URL is always updated before both the after-update event and the snippets' setup phase, but I feel like that could break a lot of stuff for people, so it'll probably be released as a minor version update.

Sign in to post a reply