Skip to content

Commit a02d4da

Browse files
Check instructions length before setting option value (#1196)
[closes](RaspberryPiFoundation/digital-editor-issues#443) I found that `const option = instructions ? "instructions" : "file";` was always being set to true because it was receiving an empty array
1 parent fee4bce commit a02d4da

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
9+
### Fixed
10+
11+
- Fixed sidebar not correctly reopening (#1196)
12+
713
## [0.29.0] - 2025-02-06
814

915
### Added

src/components/Menus/Sidebar/SidebarBar.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const SidebarBar = (props) => {
2525
const isMobile = useMediaQuery({ query: MOBILE_MEDIA_QUERY });
2626

2727
const expandPopOut = () => {
28-
const option = instructions ? "instructions" : "file";
28+
const option = instructions.length > 0 ? "instructions" : "file";
2929
toggleOption(option);
3030
if (window.plausible) {
3131
// TODO: Make dynamic events for each option or rename this event

src/components/Menus/Sidebar/SidebarBar.test.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ describe("SidebarBar", () => {
7373
<SidebarBar
7474
menuOptions={menuOptions(true)}
7575
toggleOption={toggleOption}
76-
instructions
76+
instructions={[
77+
{
78+
title: "My testing title",
79+
content: "My testing content",
80+
quiz: false,
81+
},
82+
]}
7783
/>
7884
</Provider>,
7985
);

0 commit comments

Comments
 (0)