Skip to content

Commit cd8a1cf

Browse files
committed
update stories
1 parent f4ffb45 commit cd8a1cf

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

__stories__/helpers/components/OptionsCountButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const OptionsCountButton: FunctionComponent<OptionsCountButtonProps> = ({
3737
setOptionsCount
3838
}) => {
3939
const isActive = count === optionsCount;
40-
const onClick = !isActive ? () => setOptionsCount(count) : undefined;
40+
const onClick = () => !isActive && setOptionsCount(count);
4141

4242
return (
4343
<StyledButton

__stories__/index.stories.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ export const Methods = () => {
549549

550550
return (
551551
<Container>
552-
<Title>Methods {'&'} Properties</Title>
552+
<Title>Methods & Properties</Title>
553553
<Hr />
554554
<ListWrapper>
555555
<strong>5</strong> methods and <strong>1</strong> property are exposed to
@@ -699,20 +699,15 @@ export const Filtering = () => {
699699
};
700700

701701
export const Virtualization = () => {
702+
const selectRef = useRef<SelectRef | null>(null);
702703
const optionCountList = useMemo(() => [100, 1000, 10000, 25000, 50000, 100000], []);
703704
const [optionsCount, setOptionsCount] = useState(optionCountList[0]);
704-
const [options, setOptions] = useState<Option[]>([]);
705-
const selectRef = useRef<SelectRef | null>(null);
705+
const options = useMemo<Option[]>(() => createSelectOptions(optionsCount), [optionsCount]);
706706

707707
useUpdateEffect(() => {
708708
selectRef.current?.clearValue();
709709
}, [options]);
710710

711-
useEffect(() => {
712-
const nextSelectOptions = createSelectOptions(optionsCount);
713-
setOptions(nextSelectOptions);
714-
}, [optionsCount]);
715-
716711
return (
717712
<Container>
718713
<Title>Menu List Virtualization</Title>
@@ -744,7 +739,7 @@ export const Virtualization = () => {
744739
open to performance optimizations - most notably, memoization.
745740
Simple components that rely on the props passed to it (rather than
746741
its own managed state) to generate its JSX are likely candidates for
747-
memoization (testing {'&'} debugging becomes much easier as well).
742+
memoization (testing & debugging becomes much easier as well).
748743
</Li>
749744
</List>
750745
<em>Note: </em>Potential performance degradation could be encountered during input
@@ -882,7 +877,8 @@ export const Portaling = () => {
882877
const options = useMemo<Option[]>(() => createSelectOptions(3), []);
883878

884879
const [menuOpen, setMenuOpen] = useState(false);
885-
const [menuPortalTarget, setMenuPortalTarget] = useState<Element | undefined>();
880+
const [menuPortalTarget, setMenuPortalTarget] = useState<HTMLElement | undefined>(undefined);
881+
886882
const onMenuOpen = useCallback(() => setMenuOpen(true), []);
887883
const onMenuClose = useCallback(() => setMenuOpen(false), []);
888884

@@ -910,7 +906,7 @@ export const Portaling = () => {
910906
id={portalId}
911907
menuOpen={menuOpen}
912908
>
913-
<span>portal {'<'}div /{'>'}</span>
909+
<span>portal node</span>
914910
</MenuPortalElement>
915911
</CardHeader>
916912
<CardBody>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"chromatic": "^6.11.4",
8080
"cross-env": "^7.0.3",
8181
"enzyme": "^3.11.0",
82-
"eslint": "^8.28.0",
82+
"eslint": "^8.29.0",
8383
"eslint-config-prettier": "^8.5.0",
8484
"eslint-plugin-prettier": "^4.2.1",
8585
"eslint-plugin-react": "^7.31.11",

0 commit comments

Comments
 (0)