Skip to content

Build your personal knowledge base with Trilium Notes

refactor(client): remove the global menu's experimental features submenu

Elian Doran43deb6183acc
diff --git a/apps/client/src/services/experimental_features.spec.ts b/apps/client/src/services/experimental_features.spec.ts
index 16d055a219..84d1c45bbd 100644
--- a/apps/client/src/services/experimental_features.spec.ts
+++ b/apps/client/src/services/experimental_features.spec.ts
@@ -93,15 +93,4 @@ describe("experimental_features", () => {
expect(mod.getEnabledExperimentalFeatureIds()).toEqual([]);
expect(warn).toHaveBeenCalled();
});
-
- it("toggleExperimentalFeature adds/removes a feature and persists the set", async () => {
- const { mod, options } = await freshModule([]);
- const save = vi.spyOn(options, "save").mockResolvedValue(undefined);
-
- await mod.toggleExperimentalFeature("llm", true);
- expect(save).toHaveBeenLastCalledWith("experimentalFeatures", JSON.stringify(["llm"]));
-
- await mod.toggleExperimentalFeature("llm", false);
- expect(save).toHaveBeenLastCalledWith("experimentalFeatures", JSON.stringify([]));
- });
});
diff --git a/apps/client/src/services/experimental_features.ts b/apps/client/src/services/experimental_features.ts
index 61d09d4afd..ba62d5bd79 100644
--- a/apps/client/src/services/experimental_features.ts
+++ b/apps/client/src/services/experimental_features.ts
@@ -53,16 +53,6 @@ export function getEnabledExperimentalFeatureIds() {
return values;
}
-export async function toggleExperimentalFeature(featureId: ExperimentalFeatureId, enable: boolean) {
- const features = new Set(getEnabledFeatures());
- if (enable) {
- features.add(featureId);
- } else {
- features.delete(featureId);
- }
- await options.save("experimentalFeatures", JSON.stringify(Array.from(features)));
-}
-
function getEnabledFeatures() {
if (!enabledFeatures) {
let features: ExperimentalFeatureId[] = [];
diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsx
index f5404a4c3b..7eabdf62ea 100644
--- a/apps/client/src/widgets/buttons/global_menu.tsx
+++ b/apps/client/src/widgets/buttons/global_menu.tsx
@@ -6,9 +6,8 @@ import { useContext, useEffect, useRef, useState } from "preact/hooks";
import { CommandNames } from "../../components/app_context";
import Component from "../../components/component";
-import { ExperimentalFeature, ExperimentalFeatureId, getAvailableExperimentalFeatures, isExperimentalFeatureEnabled, toggleExperimentalFeature } from "../../services/experimental_features";
import { t } from "../../services/i18n";
-import utils, { isElectron, isMobile, isStandalone, reloadFrontendApp } from "../../services/utils";
+import utils, { isElectron, isMobile, isStandalone } from "../../services/utils";
import Dropdown from "../react/Dropdown";
import { FormDropdownDivider, FormDropdownSubmenu, FormListHeader, FormListItem } from "../react/FormList";
import { useStaticTooltip, useStaticTooltipWithKeyboardShortcut, useTriliumOption, useTriliumOptionBool } from "../react/hooks";
@@ -79,7 +78,6 @@ export default function GlobalMenu({ isHorizontalLayout }: { isHorizontalLayout:
</>}
{!isElectron() && !isStandalone && <BrowserOnlyOptions />}
- {glob.isDev && <DevelopmentOptions />}
</Dropdown>
);
}
@@ -109,32 +107,6 @@ function BrowserOnlyOptions() {
</>;
}
-function DevelopmentOptions() {
- return <>
- <FormListHeader text="Development Options" />
- <FormDropdownSubmenu icon="bx bx-test-tube" title="Experimental features">
- {getAvailableExperimentalFeatures().map((feature) => (
- <ExperimentalFeatureToggle key={feature.id} experimentalFeature={feature as ExperimentalFeature} />
- ))}
- </FormDropdownSubmenu>
- </>;
-}
-
-function ExperimentalFeatureToggle({ experimentalFeature }: { experimentalFeature: ExperimentalFeature }) {
- const featureEnabled = isExperimentalFeatureEnabled(experimentalFeature.id as ExperimentalFeatureId);
-
- return (
- <FormListItem
- checked={featureEnabled}
- title={experimentalFeature.description}
- onClick={async () => {
- await toggleExperimentalFeature(experimentalFeature.id as ExperimentalFeatureId, !featureEnabled);
- reloadFrontendApp();
- }}
- >{experimentalFeature.name}</FormListItem>
- );
-}
-
function SwitchToOptions() {
if (isElectron()) {
return;