Skip to content

Commit

Permalink
Merge pull request #120 from chromaui/tom/ap-3683-possible-to-filter-…
Browse files Browse the repository at this point in the history
…out-all-stories-with-no-way-to-disable

Clear the filter when removing the sidebar toggle button
  • Loading branch information
tmeasday authored Sep 22, 2023
2 parents 8d8f09e + fd32f10 commit 3481f8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/SidebarToggleButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Badge as BaseBadge } from "@storybook/components";
import { css, styled } from "@storybook/theming";
import pluralize from "pluralize";
import React, { useState } from "react";
import React, { useEffect, useState } from "react";

import { IconButton } from "./IconButton";

Expand Down Expand Up @@ -46,6 +46,9 @@ export const SidebarToggleButton = React.memo(function SidebarToggleButton({
else onEnable();
};

// Ensure the filter is disabled if the button is not visible
useEffect(() => () => onDisable(), [onDisable]);

return (
<Button active={filter} onClick={toggleFilter}>
<Badge status="warning" data-badge={filter}>
Expand Down

0 comments on commit 3481f8c

Please sign in to comment.