Skip to content

Commit

Permalink
Fix an issue where 404s could cause a broken transition to nowhere
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewhiteley committed Mar 20, 2024
1 parent 60823b0 commit 60a9960
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/taxi.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/taxi.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/taxi.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/taxi.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/taxi.modern.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/taxi.modern.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/taxi.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/taxi.umd.js.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@unseenco/taxi",
"description": "A modern page transition library which supports routing, preloading, and additional script reloading.",
"version": "1.5.1",
"version": "1.5.3",
"license": "GPL-3.0-or-later",
"source": "src/taxi.js",
"main": "src/taxi.js",
Expand Down
5 changes: 5 additions & 0 deletions src/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export default class Core {
this.cache.get(url).renderer.createDom()
}
})
.catch(err => console.warn(err))
}

return Promise.resolve()
Expand Down Expand Up @@ -209,6 +210,10 @@ export default class Core {
this.cache.set(this.targetLocation.href, this.createCacheEntry(response.html, response.url))
this.cache.get(this.targetLocation.href).renderer.createDom()
})
.catch(err => {
// we encountered a 4** or 5** error, redirect to the requested URL
window.location.href = url
})

navigationPromise = this.beforeFetch(this.targetLocation, TransitionClass, trigger)
.then(async () => {
Expand Down

0 comments on commit 60a9960

Please sign in to comment.