Prevent logging lots of "Browser unsupported" lines (#32647)

* Store the result of getBrowserSupport

* Add supported_environment data

* Refactor

* Ensure have a cache opt-out

* docstring

* Use memoizeOne
This commit is contained in:
Will Hunt
2026-02-27 10:55:22 +00:00
committed by GitHub
parent 3fb99fee26
commit 7461cdbf3f
3 changed files with 34 additions and 26 deletions
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import { logger } from "matrix-js-sdk/src/logger";
import { checkBrowserSupport, LOCAL_STORAGE_KEY } from "../../src/SupportedBrowser";
import { getBrowserSupport, checkBrowserSupport, LOCAL_STORAGE_KEY } from "../../src/SupportedBrowser";
import ToastStore from "../../src/stores/ToastStore";
import GenericToast from "../../src/components/views/toasts/GenericToast";
@@ -18,6 +18,7 @@ describe("SupportedBrowser", () => {
beforeEach(() => {
jest.resetAllMocks();
localStorage.clear();
getBrowserSupport.clear();
});
const testUserAgentFactory =
@@ -109,6 +110,7 @@ describe("SupportedBrowser", () => {
toastSpy.mockClear();
warnLogSpy.mockClear();
getBrowserSupport.clear();
checkBrowserSupport();
expect(warnLogSpy).toHaveBeenCalledWith("Browser unsupported, but user has previously accepted");
expect(toastSpy).not.toHaveBeenCalled();