Comments (3)
Attempts to unload some of the CPU intensive calls (i.e. fetchRepo
, fetchBranches
, updateVersionedMetafile
) to background threads inevitably result in a catch-22 situation. For example, in order to use Web Workers in a Node.js environment using webpack, you must use ESM per webpack docs:
Similar syntax is supported in Node.js (>= 12.17.0):
import { Worker } from 'worker_threads'; new Worker(new URL('./worker.js', import.meta.url));Note that this is only available in ESM. Worker in CommonJS syntax is not supported by either webpack or Node.js.
But attempts to run this code in Electron result in the following:
This is because Electron currently only supports CommonJS modules. However, there are some potential future fixes that might introduce ESM support in Electron in the future:
from synectic.
Other multi-threading options include:
-
Attempting to use Electron's
utilityProcess
to create child processes with Node.js and Message ports enabled. It provides the equivalent ofchild_process.fork
API from Node.js but instead uses Services API from Chromium to launch the child process. Although, this option requires resolving some of the restrictions placed on these processes under the Electron Context Isolation feature. -
Using
electron-redux@alpha
which provides a Redux Store Enhancer that helps loosely synchronize the redux stores in multiple Electron processes. The use case for this module is described as:When working with Electron, using Redux poses couple of problems, since main and renderer processes are isolated and IPC is a single way of communication between them. This library, enables you to register all your Redux stores in the main & renderer process, and enable cross-process action dispatching & loose store synchronization.
However, the v2 alpha branch throws errors when attempting to launch Synectic and only the older v1 is able to startup. But the v1 version has a major sticking point, which is outlined in their The road to electron-redux 2.0 issue, and that is that v1 still uses Electron's
remote
dependency. Theremote
module was deprecated in Electron 14.0, which was released on 2021-Aug-31 and reached EOL on 2022-Mar-29; which is a significantly older version given that the current version is 25.0.0 as of 2023-May-30. -
There is
redux-state-sync
which is a lightweight Redux Middleware for syncing your redux state across browser tabs. It uses the Electron Broadcast Channel API to listen and dispatch exactly the same actions that were dispatched in other tabs to keep the redux state in sync. Unfortunately, this library requires modifying the Redux-Toolkit built-in reducers provided bycreateEntityAdapter
as a workaround described in aohua/redux-state-sync#124.
from synectic.
Resolved in Synectic v4.0.0.
from synectic.
Related Issues (20)
- `ENOENT: no such file or directory, getRoot` error thrown when branch is "prunable"
- Undo/Redo actions in Synectic editors using `redux-undo`
- `Manifest version 2 is deprecated, and support will be removed in 2023`
- Cache subscriptions drop multiple reserves on `metafiles/switchBranch` action
- Use `createAsyncThunk.withTypes<>()` from RTK 1.9 for pre-typed `createAsyncThunk`
- `FSCache` event handler uses stale `reserved` state when updating cache after edit/save
- Deprecate and replace `uuid` library with built-in JavaScript `Crypto` library
- Improve return type of `utils.removeUndefinedProperties` to exclude `never` properties HOT 4
- Upgrade to React 18 HOT 1
- Upgrade to Yarn 4 HOT 1
- Installation via `deb` package fails on Ubuntu Linux HOT 2
- `+[CATransaction synchronize] called within transaction` on MacOS HOT 1
- Checkout or switch to remote-only branch results in `fatal: ambiguous argument '<branch>': unknown revision or path not in the working tree.` HOT 1
- `fatal: detected dubious ownership in repository` on Windows HOT 2
- `fatal: cannot lock ref 'refs/heads/extra'` on Windows HOT 1
- Switch `electron-forge` for `conveyor` packaging tool HOT 5
- Bundler updating HOT 5
- Option to delete files
- Visual overlapping (`z-index`) when cards expanded into fullscreen mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from synectic.