File tree Expand file tree Collapse file tree
apps/qwikrouter-test/src/routes/issue4502/broken Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import type { RequestHandler } from '@qwik.dev/router' ;
1+ import { component$ } from '@qwik.dev/core' ;
2+ import { routeLoader$ , type RequestHandler } from '@qwik.dev/router' ;
3+
4+ // We need a routeLoader$ here to ensure the page is loaded via the loader URL (q-loader-*.json) which triggers the onRequest middleware.
5+ export const useForceLoadingThisIndex = routeLoader$ ( ( ) => null ) ;
26
37export const onRequest : RequestHandler < void > = async ( onRequestArgs ) => {
48 const { redirect, url } = onRequestArgs ;
59 throw redirect ( 302 , `${ url . pathname } /route/` ) ;
610} ;
11+
12+ export default component$ ( ( ) => {
13+ useForceLoadingThisIndex ( ) ;
14+ return (
15+ < div id = "index" >
16+ You should be redirecting to < code > /broken/route</ code >
17+ </ div >
18+ ) ;
19+ } ) ;
Original file line number Diff line number Diff line change @@ -60,9 +60,6 @@ test.describe('loaders', () => {
6060 await expect ( title ) . toHaveText ( 'Loaders - Qwik' , { useInnerText : true } ) ;
6161 await expect ( date ) . toHaveText ( 'date: 2021-01-01T00:00:00.000Z' ) ;
6262 await expect ( slow ) . toHaveText ( 'slow: 123' ) ;
63- if ( javaScriptEnabled ) {
64- await expect ( nestedName ) . toHaveText ( 'name: stuff' ) ;
65- }
6663 await expect ( nestedName ) . toHaveText ( 'name: welcome' ) ;
6764 await expect ( nestedDate ) . toHaveText ( 'date: 2021-01-01T00:00:00.000Z' ) ;
6865 await expect ( nestedDep ) . toHaveText ( 'dep: 84' ) ;
You can’t perform that action at this time.
0 commit comments