Always show back button in the right panel (#29128)

* Construct history on setCard

So that back buttons are always shown in the right panel

* Check card state to ensure operation is atomic

* Fix tests

* Fix lint

* Remove null case

* Fix broken test
This commit is contained in:
R Midhun Suresh
2025-02-03 00:07:12 +05:30
committed by GitHub
parent 4cba79ddcc
commit aa01b17f9e
4 changed files with 61 additions and 11 deletions

View File

@@ -114,11 +114,14 @@ describe("RightPanelStore", () => {
expect(store.isOpenForRoom("!1:example.org")).toEqual(true);
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.RoomSummary);
});
it("overwrites history if changing the phase", async () => {
it("history is generated for certain phases", async () => {
await viewRoom("!1:example.org");
store.setCard({ phase: RightPanelPhases.RoomSummary }, true, "!1:example.org");
// Setting the memberlist card should also generate a history with room summary card
store.setCard({ phase: RightPanelPhases.MemberList }, true, "!1:example.org");
expect(store.roomPhaseHistory).toEqual([{ phase: RightPanelPhases.MemberList, state: {} }]);
expect(store.roomPhaseHistory).toEqual([
{ phase: RightPanelPhases.RoomSummary, state: {} },
{ phase: RightPanelPhases.MemberList, state: {} },
]);
});
});