Git Product home page Git Product logo

Comments (3)

nelsonni avatar nelsonni commented on July 24, 2024

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:
image

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.

nelsonni avatar nelsonni commented on July 24, 2024

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 of child_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. The remote 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 by createEntityAdapter as a workaround described in aohua/redux-state-sync#124.

from synectic.

nelsonni avatar nelsonni commented on July 24, 2024

Resolved in Synectic v4.0.0.

from synectic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.