electron / electron/fiddle

Prevent Removing Other Window Current Versions

Open
#1,394 0 comments 0 reactions 0 assignees View on GitHub
:sparkles: enhancement area:versions
Dominant language
TypeScript
Stars
7.8k
Forks
762
Avg merge
15h 27m
Merged PRs (30d)
12

Description

Currently the active version is prevented from being removed in Settings -> Electron, but if multiple windows are open this doesn't prevent one window from removing another window's active version, causing problems.

An elegant solution here could be [Web locks](https://w3c.github.io/web-locks/) - create a shared lock (`version:`) on the version that a window is currently using, and release it when the current version is changed. Then modify the code that prevents removing an active version to check if a version is currently locked (`navigator.locks.query` wrapped inside a helper function). Potential problem with this approach is `navigator.locks.query` is async, and the current UI doesn't handle async state. Looks like we could probably use `react-async` for the moment (with an upgrade from React v16.14 to v16.18) and then use Suspense in the future when React is upgraded to v18+.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.