Skip to content

Commit

Permalink
Fix query string in navigate
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed Jul 24, 2023
1 parent 53ac2dd commit 69c640f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion packages/navigate/src/fetch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

export function fetchHtml(destination, callback) {
fetch(destination.pathname).then(i => i.text()).then(html => {
let uri = destination.pathname + destination.search

fetch(uri).then(i => i.text()).then(html => {
callback(html)
})
}
16 changes: 8 additions & 8 deletions packages/navigate/src/prefetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ export function storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination) {
}

export function getPretchedHtmlOr(destination, receive, ifNoPrefetchExists) {
let path = destination.pathname
let uri = destination.pathname + destination.search

if (! prefetches[path]) return ifNoPrefetchExists()
if (! prefetches[uri]) return ifNoPrefetchExists()

if (prefetches[path].finished) {
let html = prefetches[path].html
if (prefetches[uri].finished) {
let html = prefetches[uri].html

delete prefetches[path]
delete prefetches[uri]

return receive(html)
} else {
prefetches[path].whenFinished = () => {
let html = prefetches[path].html
prefetches[uri].whenFinished = () => {
let html = prefetches[uri].html

delete prefetches[path]
delete prefetches[uri]

receive(html)
}
Expand Down

0 comments on commit 69c640f

Please sign in to comment.