Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Fragment symbol comparable across module instances
When debugging Forgo using `npm link`, Vite's pre-bundling optimization executes the `forgo` module twice ([Vite bug](vitejs/vite#3910), [Svelte bug with workarounds](sveltejs/vite-plugin-svelte#135 (comment))). It doesn't happen when using the package from npm. This results in different code paths holding references to two different `Fragment` symbols, causing renders to fail because the two symbols aren't comparable using `===`. Using `Symbol.for()` makes all symbols named `FORGO_FRAGMENT` comparable, no matter where they come from. Alternatively, there's a workaround to have Vite disable pre-bundling optimizations for `forgo`, but this patch makes that unnecessary.
- Loading branch information