@glitchr/transparent 1.0.80 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/transparent",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -1486,11 +1486,19 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
1486
1486
  (function() {
1487
1487
  function doCallback() {
1488
1488
  _tx("doCallback FIRES → callback() (which starts fadeOut)");
1489
- $('head').append(function() {
1490
- $(Settings.identifier).append(function() {
1491
- callback();
1492
- dispatchEvent(new Event('transparent:load'));
1493
- dispatchEvent(new Event('load'));
1489
+ // requestAnimationFrame here guarantees the browser has had one
1490
+ // full frame to apply the new page's stylesheets and re-layout
1491
+ // before fadeOut starts. Without it, fadeOut can animate the
1492
+ // loader away while the new page is still rendered with the
1493
+ // previous layout's styles — the article→home flicker the
1494
+ // [TX] trace masked via instrumentation overhead.
1495
+ requestAnimationFrame(function() {
1496
+ $('head').append(function() {
1497
+ $(Settings.identifier).append(function() {
1498
+ callback();
1499
+ dispatchEvent(new Event('transparent:load'));
1500
+ dispatchEvent(new Event('load'));
1501
+ });
1494
1502
  });
1495
1503
  });
1496
1504
  }