Use WASM in DOPP by default
in progress
Tobe Osakwe
Historically, our app has had 2 separate implementations of discount calculation logic: one in Rust that runs in the cart/checkout, and one in TypeScript that runs on product pages, collection pages, etc.
This has led to a number of bugs and inconsistencies, as well as slowing down new feature releases, as features must be implemented in both.
In fact, we've completely decided to not implement certain major, highly-complex features to the TypeScript version, such as "Buy X" steps.
Instead, our long-term plan is to get rid of the TypeScript version and provide users with the Rust-based logic, in the form of a WebAssembly binary.
(You can already use this today by setting the "Feature flags" setting of the "Discounts Embed" app embed to "useWasm".)
The purpose of this feature request is to track our progress towards completely removing the TypeScript-based logic and using WebAssembly everywhere.
Potential challenges:
- Ensuring this works in all browsers
- If we ever add Checkout UI extensions to our app, we will need to find a way to include WASM; otherwise, we can't get rid of the TS version completely.
Tobe Osakwe
marked this post as
in progress
We rolled this out previously, but it led to memory leaks on certain sites. We had to roll it back. We have not had an opportunity to debug this on those sites yet, so this is going to have to wait until time clears up.
Tobe Osakwe
marked this post as
complete
WebAssembly discount calculation is finally live! To disable it, use the
noWasm
feature flag in the "Discounts Embed."Tobe Osakwe
marked this post as
planned
- We have been able to reduce the WASM significantly.
- After looking at the JS size of other very popular apps, it's far higher than ours would be, even with WASM, so we're green-lighting this once all possible optimizations have made.
Tobe Osakwe
marked this post as
closed
Unfortunately, due to WASM file size, this won't be possible.
Tobe Osakwe
marked this post as
in progress