Skip to content

Commit

Permalink
fix: no load on hash fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Oct 18, 2022
1 parent 551dada commit 35d624f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-crews-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hydrofoil/shell-resources": patch
---

Do not load from API when new URL differs only in hash fragment
12 changes: 12 additions & 0 deletions packages/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ function effects(store: Store) {
}
},
'routing/resource': (id: string) => {
const newUrl = new URL(id)
newUrl.hash = ''
const currentId = store.getState().core.contentResource?.id.value
if (currentId) {
const currentUrl = new URL(currentId)
currentUrl.hash = ''

if (currentUrl.toString() === newUrl.toString()) {
return
}
}

dispatch.resource.load(id)
},
}
Expand Down

0 comments on commit 35d624f

Please sign in to comment.