Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion documentation-site/components/overrides.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import { trackEvent } from "../helpers/ga";
const isStyledExport = (exportName) => exportName.startsWith("Styled");
const getOverrideName = (exportName) => exportName.replace("Styled", "");
const getOverrides = (component, blacklisted, whitelisted) => {
if (whitelisted) return whitelisted.sort();
// Copy before sorting: Array.prototype.sort() mutates in place, and
// `whitelisted` is a prop passed in by the caller (which may be a
// shared/reused array reference, e.g. a module-level constant). Sorting
// it directly would silently reorder the caller's own array as a side
// effect.
if (whitelisted) return [...whitelisted].sort();
return component
? Object.keys(component)
.filter(isStyledExport)
Expand Down