klarna / electron-redux

Use redux in the main and browser processes in electron
MIT License
743 stars 94 forks source link

šŸ”„ The road to electron-redux 2.0 #258

Open matmalkowski opened 3 years ago

matmalkowski commented 3 years ago

In this issue I would like to create a clean overview and expected features that would make up for the next major release, the 2.0.0

What should be part of v2?

When the v2 could be expected

We would like to start working on the new version in October 2020. It would also mean that some of the changes could be great opportunity to get your contributions during the Hacktoberfest!

Please use this issue to submit your feedback about expected feature set, ideas on what could be added as part of this major release, as well as interest in contributing to that huge change!

Tagging @partheseas since we would love to use your TS refactor from the fork šŸ˜„

aslilac commented 3 years ago

Go for it!

Kupstas commented 3 years ago

Any news. I can't migrate to 11 electron because of remote dependency

matmalkowski commented 3 years ago

@Kupstas , still doing some work on it, but the main thing is right now available as an alpha release - we still might change the API a bit, as we got some more tickets with TS to cover (& some features might not yet been ported). Feel free to take it for a spin, latest version is 2.0.0-alpha.5

The code is on alpha branch

aslilac commented 3 years ago

@Kupstas You can use Electron 11, you just need to add some config

new BrowserWindow({
    webPreferences: {
        enableRemoteModule: true,
        nodeIntegration: true,
    },
});

Or you can use my fork, "@mckayla/electron-redux", which is actually what this update is being rebased on.

Nantris commented 3 years ago

@matmalkowski is it planned to remove the Redux state from the global scope of the main process, since remote.getGlobal() will no longer be in use?

matmalkowski commented 3 years ago

@Slapbox V2 doesn't expose redux state globally anywhere for main nor renderer

linonetwo commented 3 years ago

@partheseas

Do we still need enableRemoteModule: true, ? I can see latest v2 have removed it.

And I think nodeIntegration should be false, so we can keep our preloadScript.

aslilac commented 3 years ago

@linonetwo So to be clear, I'm the maintainer of "@mckayla/electron-redux". This repo is for the package "electron-redux".

For "electron-redux", enableRemoteModule is no longer needed, but nodeIntegration is still required in v2. For @mckayla/electron-redux, in v3 I removed the nodeIntegration requirement in favor of using preload instead.

aslilac commented 3 years ago

@matmalkowski I've actually been meaning to reach out to you guys about that. I've updated my fork to no longer require nodeIntegration to be enabled, and you're more than welcome to look at my implementation and do the same!

linonetwo commented 3 years ago

Great work @partheseas , That will make it more secure for apps with dynamic content like the one I have.

matmalkowski commented 3 years ago

@partheseas Nice :) We will evaluate how to do this in v2 as well than šŸ‘šŸ» (And if anyone is eager to do it, we are happy to help with the pull request šŸ˜‰)

benjaffe commented 3 years ago

One neat feature to consider is allowing configuration of what clients electron-redux forwards to. In my team's case, we have a desktop app with multiple separate stores, one for each file we're opening. And for each file, we have 1 or more associated renderers.

I haven't thought it through fully, but it might be simple to allow users to use electron-redux, passing in config which isolates the communication to a particular channel over ipc, allowing multiple instances to run independently without stepping on each other.

Just posting this here as food for thought. Thank you all for your work on electron-redux <3

Nantris commented 3 years ago

@benjaffe what's the use case for multiple independent stores?

benjaffe commented 3 years ago

Oh goodness, sorry the notif slipped by me. My electron app handles media project files (like Photoshop does with PSDs for example), and the app can have multiple project files open. These files can be very large, so while I could use a single store with each project file as an entry in a top-level map, it would only slow things way down for us (on things like revert operations for example, where every client would need to do a bunch of stuff, even though it only matters to a single client). The project files (and the associated windows we open for them) are entirely independent from each other.

It's much easier to reason about and more performant to have a store for each project file. Happy to provide more info if that'd help clarify this use case.

Treverix commented 3 years ago

The remote module was removed with Electron 14 which has just been released. electron-redux now needs to be updated to use @electron/remote instead, which is a full replacement.

Nantris commented 3 years ago

@Treverix please see the alpha branch for the new API. remote will not be included in electron-redux@2.x to my knowledge.

binarybaron commented 3 months ago

Is this planned to be released eventually?

Nantris commented 3 months ago

@binarybaron doubtful. Klarna suffered layoffs around the time things got quiet here. We've used the alpha versions of 2.0 in production for years without trouble though.