Skip to content

Commit fada6e8

Browse files
fix: wrong toggle state (#136)
1 parent fdfa79f commit fada6e8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

library/src/components/Toggle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const Toggle: React.FunctionComponent<Props> = ({
8282
// for collapsing items in container when container will collapse
8383
if (
8484
!(clickedItem && clickedItem.state) &&
85-
ITEM_LABELS_VALUES.toString().includes(label) &&
85+
ITEM_LABELS_VALUES.includes(label) &&
8686
clickedItem.label === inContainer(label as ITEM_LABELS)
8787
) {
8888
setExpanded(false);
@@ -93,7 +93,7 @@ export const Toggle: React.FunctionComponent<Props> = ({
9393
// for container when hash will change
9494
if (
9595
clickedItem.label === label &&
96-
CONTAINER_LABELS_VALUES.toString().includes(label)
96+
CONTAINER_LABELS_VALUES.includes(label)
9797
) {
9898
setExpanded(true);
9999
return;

library/src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ export enum CONTAINER_LABELS {
122122
MESSAGES = 'messages',
123123
SCHEMAS = 'schemas',
124124
}
125-
export const CONTAINER_LABELS_VALUES = Object.values(CONTAINER_LABELS);
125+
export const CONTAINER_LABELS_VALUES = Object.values<string>(CONTAINER_LABELS);
126126
export enum ITEM_LABELS {
127127
CHANNEL = 'channel',
128128
SERVER = 'server',
129129
MESSAGE = 'message',
130130
SCHEMA = 'schema',
131131
}
132-
export const ITEM_LABELS_VALUES = Object.values(ITEM_LABELS);
132+
export const ITEM_LABELS_VALUES = Object.values<string>(ITEM_LABELS);

0 commit comments

Comments
 (0)