Skip to content

Commit 8417216

Browse files
committed
docs: fix material-icons after SSR
It looks like `Object.entries` had a different order between node and the browser which caused the icons to not match correctly after SSR. Closes #1423
1 parent d38cc29 commit 8417216

File tree

1 file changed

+8
-3
lines changed
  • packages/documentation/src/components/Demos/MaterialIcons

1 file changed

+8
-3
lines changed

packages/documentation/src/components/Demos/MaterialIcons/AllIcons.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ import Code from "components/Code";
66

77
import styles from "./AllIcons.module.scss";
88

9-
const allIcons = Object.entries(MaterialIcons).filter(([name]) =>
10-
name.endsWith("SVGIcon")
11-
);
9+
const compare = new Intl.Collator("en-US", {
10+
caseFirst: "upper",
11+
numeric: true,
12+
}).compare;
13+
14+
const allIcons = Object.entries(MaterialIcons)
15+
.filter(([name]) => name.endsWith("SVGIcon"))
16+
.sort(([a], [b]) => compare(a, b));
1217

1318
function TooltippedName({ name }: { name: string }): ReactElement {
1419
const { elementProps, tooltipProps } = useTooltip({

0 commit comments

Comments
 (0)