Skip to content

Commit 397df96

Browse files
[learn] Fix hard reload or initial load not respecting filter hash (#1259)
1 parent 2033a29 commit 397df96

File tree

1 file changed

+4
-3
lines changed
  • packages/lit-dev-content/src/pages

1 file changed

+4
-3
lines changed

packages/lit-dev-content/src/pages/learn.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,14 @@ const initChipsFromURL = async (hash = window.location.hash) => {
9595
(chip as FilterChip).selected =
9696
kinds.length === 0 || kinds.includes(chipKind);
9797
});
98+
99+
// Do not update hash to prevent an infinite loop.
100+
updateContentFromChips(false);
98101
};
99102

100-
// Handles forwads and back navigation between hashes
103+
// Handle forwards and back navigation between hashes
101104
window.addEventListener('hashchange', async (event: HashChangeEvent) => {
102105
await initChipsFromURL(new URL(event.newURL).hash);
103-
// Do not update hash to prevent an infinite loop.
104-
await updateContentFromChips(false);
105106
});
106107

107108
// Handles clicking a filter chip.

0 commit comments

Comments
 (0)