review: Keep previous behavior for now to always auto switch

This commit is contained in:
Valere
2025-12-03 09:01:26 +01:00
parent b85f36598c
commit a93ceeae4b
2 changed files with 10 additions and 7 deletions

View File

@@ -101,21 +101,24 @@ test("Can manually force grid when there is a screenshare", () => {
});
});
test("Should not auto-switch after manually selected grid", () => {
test("Should auto-switch after manually selected grid", () => {
withTestScheduler(({ cold, behavior, expectObservable, schedule }): void => {
const { gridMode$, setGridMode } = createLayoutModeSwitch(
scope,
behavior("n", { n: "normal" }),
// Two screenshares will happen in sequence
cold("-ft-ft", { f: false, t: true }),
);
// There was a screen-share that forced spotlight, then
// the user manually switch back to grid
schedule("---g", {
g: () => setGridMode("grid"),
});
const expectation = "ggsg";
// If we did not respect manual selection, the expectation would be:
// const expectation = "ggsg-s";
// If we did want to respect manual selection, the expectation would be:
// const expectation = "ggsg";
const expectation = "ggsg-s";
expectObservable(gridMode$).toBe(expectation, {
g: "grid",

View File

@@ -97,9 +97,9 @@ export function createLayoutModeSwitch(
}
// Respect user's grid choice
// XXX If we want to allow switching automatically again after we can
// return hasAutoSwitched: false here instead of keeping the previous value.
return { mode: "grid", hasAutoSwitched: acc.hasAutoSwitched };
// XXX If we want to forbid switching automatically again after we can
// return hasAutoSwitched: acc.hasAutoSwitched here instead of setting to false.
return { mode: "grid", hasAutoSwitched: false };
},
// initial value
{ mode: "grid", hasAutoSwitched: false },