Skip to content

Commit 1757874

Browse files
committed
feat: deprecate experiments
This adds mechanism for deprecating experiments, using npm-on-ipfs as an example. We keep showing experiment if it is enabled, but hide it from UI if it is disabled, which will slowly phase it out. License: MIT Signed-off-by: Marcin Rataj <[email protected]>
1 parent 1e00334 commit 1757874

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/tray.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ const CONFIG_KEYS = [
3232
NAMESYS_PUBSUB_KEY
3333
]
3434

35+
// We show them if user enabled them before, but hide when off
36+
const DEPRECATED_KEYS = new Set([
37+
NPM_IPFS_KEY // superseded by https://github.com/forestpm/forest
38+
])
39+
3540
function buildCheckbox (key, label) {
3641
return {
3742
id: key,
3843
label: i18n.t(label),
3944
click: () => { ipcMain.emit(`toggle_${key}`) },
4045
type: 'checkbox',
46+
visible: !DEPRECATED_KEYS.has(key),
4147
checked: false
4248
}
4349
}
@@ -336,7 +342,9 @@ module.exports = function (ctx) {
336342

337343
// Update configuration checkboxes.
338344
for (const key of CONFIG_KEYS) {
339-
menu.getMenuItemById(key).checked = store.get(key, false)
345+
const enabled = store.get(key, false)
346+
menu.getMenuItemById(key).checked = enabled
347+
menu.getMenuItemById(key).visible = !DEPRECATED_KEYS.has(key) || enabled
340348
}
341349

342350
if (!IS_MAC && !IS_WIN) {

0 commit comments

Comments
 (0)