All project notes

Contribution

Reza Rosli on candypixel.js

Reorganised the browser embed around dedicated helpers in the 3.6.11 rewrite and fixed when queued submissions resume.

In March 2022, Reza rewrote the browser embed around smaller helpers for session storage, campaign tracking, query strings, script loading, and HTTP requests. The rewrite imports js-cookie and uses is-empty and hash-wasm through its utility module. Its first-parent integration is recorded at 6d09a50 and the browser build at 7560680. In the separate service checkout, d76e683 updates the 3.6.11 snippet and warns that earlier custom code and snippets are incompatible.

The new structure made a timing problem visible in September. A form saved in session storage could be retried during the same initialization phase that set up campaign tracking. At c433a46, Reza moved the retry after initialization completed. That lets the pending submission use the campaign tracker state set up for the current page.

From the diff

src/candypixel.js at c433a46. Pending submission moves outside the group of concurrent initialization calls.

             this._detectAdBlocker(),
             this._setupCandyCrumbs(),
             this.detectForms(),
-            this.checkPendingSubmission(),
         ]);
 
+        await this.checkPendingSubmission();
+
         this.isReady = true;

Selected commit log

  • 2022-03-23 · 98f1385 · Feature/rewrite candypixel
  • 2022-03-23 · 6d09a50 · Merge the rewrite into master
  • 2022-03-23 · 7560680 · Build v3.6.11
  • 2022-09-20 · c433a46 · Fix the race between pending submissions and campaign tracking