White Screen / Blank View in routes if view is not imported
See original GitHub issueDescription of the bug
Using the hilla-grocery-app example from the tutorial, When creating or adding a new route to “routes.ts”, it would compile just fine, but showing blank/white/empty view with no error messages / warnings on both backend and frontend.
export const views: ViewRoute[] = [
// place routes below (more info https://vaadin.com/docs/latest/fusion/routing/overview)
{
path: '',
component: 'grocery-view',
icon: '',
title: '',
},
{
path: 'grocery',
component: 'grocery-view',
icon: 'la la-list-alt',
title: 'Grocery',
},
{
path: 'contact', // <------------- NEW ROUTE
component: 'contact-view',
icon: 'la la-list-alt',
title: 'Contact',
},
];
For the new route to be recognized, the view needs to be imported. If the line below does not exist, you’ll get the blank view.
import { Route } from '@vaadin/router';
import './views/grocery/grocery-view';
import './views/main-layout';
import './views/contact-view'; // <------------ NEED THIS LINE
Minimal reproducible example
As Above.
Expected behavior
Some checks should be performed and an error message should be displayed if the route is unknown or the view cannot be found.
Better yet, maybe don’t use strings for the component reference and trigger an error during compilation. (Cf: maybe compare how the Angular router uses actual class/view object reference, not a string.)
Actual behavior
No errors/warnings, blank view.
Versions:
- Hilla 1.0.0 / 1.0.1 / 1.0. 2
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (6 by maintainers)
Top Results From Across the Web
React Router: How to fix BrowserRouter showing the blank ...
1 Answer 1 ... If you have react-router-dom V6, then you have to use Routes and Route both at a time to make...
Read more >React Router Dom react js shows a Blank white screen - Reddit
React Router Dom react js shows a Blank white screen. I added React Router Dom to my project. App.js: import React from 'react'...
Read more >Common mistakes - React Navigation
If you wrap the AppContainer in a View , make sure the View is has flex: 1 in the styles. import React from...
Read more >Blank page in browser after running build on create-react-app ...
app and i ran the build it shows blank screen see the code below import ... Routes, Route } from "react-router-dom"; import User...
Read more >loading component from router returns blank white page with ...
What might be a problem is that you mount the main instance to the #app element, and then you have that App component...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A minimal fix for that — the router could check if the component is registered under the name while rendering navigation results.
Optimally, we should probably support using component class names in the route map, so that TypeScript does static checking here.
The import needed at the beginning of the file is also eager, right? That is currently the only solution. Maybe it would be best to change the sample code so that it fails if you try to copy-paste to add a new route?