Skip to content

Commit

Permalink
Website: 🐛 code example chip to same on first page (#3310)
Browse files Browse the repository at this point in the history
* 🐛 fix bug still appearing on first page load

* Website: ♻️
  • Loading branch information
JulianNymark authored Oct 31, 2024
1 parent 35f7355 commit a9a1182
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,18 @@ const ComponentExamples = ({ node }: CodeExamplesProps) => {
<Chips>
{node.dir.filer.map((fil) => {
const id = `${node.dir.title.toLowerCase()}demo-${fil.navn}`;
const isSelected = active === fil.navn;
return (
<Chips.Toggle
checkmark={false}
key={fil._key}
value={fil.navn}
selected={active === fil.navn}
selected={isSelected}
id={id}
onClick={() => {
const newPath = `${router.asPath.split("#")[0]}#${id}`;
if (newPath === router.asPath) return;
if (isSelected) return;
setUnloaded(true);
const newPath = `${router.asPath.split("#")[0]}#${id}`;
router.replace(newPath);
}}
>
Expand Down

0 comments on commit a9a1182

Please sign in to comment.