Version 0.20260804.0 - #545
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR bumps the package version and updates how the renderer resolves/loads libOpenCOR’s WebAssembly “glue” (libopencor.js), including adjusting where the build-time download is placed and removing the now-unused __LIBOPENCOR_WASM_BASE_URL__ define.
Changes:
- Move the downloaded
libopencor.jsintopublic/libopencor/downloads/wasm/<version>/to align with the new runtime URL strategy. - Rework runtime initialisation to prefer a same-origin libopencor.js when available, otherwise fall back to fetching/patching from
https://opencor.ws. - Remove
__LIBOPENCOR_WASM_BASE_URL__from Vite/Electron defines and TypeScript shims.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/renderer/vite.lib.config.ts |
Downloads libopencor.js into the new libopencor/downloads/wasm/... public path and removes the base-URL define. |
src/renderer/vite.config.ts |
Same as above for the app build config. |
src/renderer/src/types/shims.d.ts |
Removes the shim for __LIBOPENCOR_WASM_BASE_URL__ since it’s no longer defined/used. |
src/renderer/src/common/initialisation.ts |
Updates libOpenCOR loading to try same-origin first, then fallback to opencor.ws with worker URL patching. |
src/renderer/package.json |
Bumps renderer package version to 0.20260804.0. |
package.json |
Bumps root package version to 0.20260804.0. |
electron.vite.config.ts |
Removes the base-URL define from the Electron renderer build defines. |
Suppressed comments (1)
src/renderer/src/common/initialisation.ts:159
- libOpenCORWorkerUrl is created unconditionally, but if the worker URL pattern is not found you fall back to importing directly from https://opencor.ws and the blob URL is never used/revoked. This leaks an object URL each time initialisation runs in that fallback path.
} else {
// The glue doesn't contain the expected worker-script URL, which means a future version of libOpenCOR generates
// different code. So, import it directly from https://opencor.ws, which works in standard browsers (the worker
// will then be cross-origin, which is allowed with CORS), but may not in restricted ones.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactored the initialisation of the Web app to load and instantiate libOpenCOR through a shared helper, then prefer same-origin glue URLs before falling back to opencor.ws.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/renderer/src/common/initialisation.ts:179
- If
importAndInstantiateLibOpenCOR(patchedLibOpenCORUrl)throws,libOpenCORWorkerUrlis currently never revoked. Since the worker blob URL is only needed when the patched glue successfully loads, this can leak a blob URL (and its backing source) on the failure path. Consider revokinglibOpenCORWorkerUrlin acatchbefore rethrowing, while still keeping it alive on success for libOpenCOR's lazy worker spawning.
try {
await importAndInstantiateLibOpenCOR(patchedLibOpenCORUrl);
} finally {
// The patched glue has now been imported, so its blob URL is no longer needed and can be revoked.
// Note: libOpenCORWorkerUrl, on the other hand, must remain valid since libOpenCOR spawns its module worker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.