Skip to content

Commit

Permalink
Revert "feat: add support for proper tracking in a speculative pre-re…
Browse files Browse the repository at this point in the history
…ndering context (#102)"

This reverts commit aba822a.
  • Loading branch information
kptdobe committed Oct 7, 2024
1 parent c58d021 commit 543fa72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
7 changes: 1 addition & 6 deletions src/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,5 @@ export function setup() {
/* c8 ignore next 18 */
export function init() {
setup();
// Prerender-aware initialization
if (document.prerendering) {
document.addEventListener('prerenderingchange', sampleRUM, { once: true });
} else {
sampleRUM();
}
sampleRUM();
}
10 changes: 1 addition & 9 deletions test/setup/setup.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/* eslint-env mocha */
import { runTests } from '@web/test-runner-mocha';
import { expect } from '@esm-bundle/chai';
import { setup, init } from '../../src/setup.js';
import { setup } from '../../src/setup.js';

runTests(() => {
it('setup - defines window.hlx', () => {
Expand All @@ -33,14 +33,6 @@
expect(window.hlx.codeBasePath).to.be.equal('/some/path');
expect(window.hlx.lighthouse).to.be.false;
});

it('init - does not enable RUM during prerendering', () => {
Object.defineProperty(document, 'prerendering', { value: true });
init();
expect(window.hlx.rum).to.be.undefined;
document.dispatchEvent(new Event('prerenderingchange'));
expect(window.hlx.rum).to.not.be.undefined;
});
});
</script>
</body>
Expand Down

0 comments on commit 543fa72

Please sign in to comment.