nitro-web 0.0.165 → 0.0.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/app.tsx +4 -8
- package/package.json +1 -1
package/client/app.tsx
CHANGED
|
@@ -219,14 +219,10 @@ function getRouter({ settings, config }: { settings: Settings, config: Config })
|
|
|
219
219
|
}
|
|
220
220
|
for (const key of route.middleware) {
|
|
221
221
|
const error = settings.middleware[key](route, exposedStoreData || {})
|
|
222
|
+
// Note: the redirect uses the new pathname for query string values, e.g. '?example=value'. We also can't use the
|
|
223
|
+
// current pathname, as this doesn't exist on page refresh.
|
|
222
224
|
if (error && error.redirect) {
|
|
223
|
-
|
|
224
|
-
// redirect loops! We assume these query string redirects are intended to be relative to the current path.
|
|
225
|
-
if (error.redirect.startsWith('?')) {
|
|
226
|
-
return redirect(window.location.pathname + error.redirect)
|
|
227
|
-
} else {
|
|
228
|
-
return redirect(error.redirect)
|
|
229
|
-
}
|
|
225
|
+
return redirect(error.redirect)
|
|
230
226
|
}
|
|
231
227
|
}
|
|
232
228
|
return null
|
|
@@ -286,7 +282,7 @@ function catchRedirectLoop(request: Request, routeName: string) {
|
|
|
286
282
|
lastRedirectTimesForSameUrl.push(Date.now())
|
|
287
283
|
if (lastRedirectTimesForSameUrl.length > 5 && (Date.now() < lastRedirectTime + 100)) {
|
|
288
284
|
throw new Error(
|
|
289
|
-
`Nitro: A redirect loop has been detected for route '${routeName}'. This
|
|
285
|
+
`Nitro: A redirect loop has been detected for route '${routeName}'. This is most likely due to a redirect loop caused by your middleware. Consider triggered by redirect values without a pathname, e.g. '?example=value'.`
|
|
290
286
|
)
|
|
291
287
|
}
|
|
292
288
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.166",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|