You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
React Router Full Page Load while clicking link in dialog #19630
When I click a RouterLink within a Dialog I expect that the already rendered MainLayout is shown / preserved and no white background / full page reload happens.
This problem might be occurring because when a RouterLink is used inside a dialog, it tries to navigate as if it's part of the main layout, which is not fully compatible with how dialogs handle their content. Dialogs are generally meant for small, self-contained interactions and are not designed to handle navigation or the lifecycle of routing in the same way as components directly managed by the router.
You can try to change the RouterLink to a Button and manually handle the navigation. This can prevent the default routing behavior that causes the full page reload.
For example this way:
` Button button = new Button("Click me to open dialog with link", event -> {
Dialog dialog = new Dialog();
dialog.add(new Button("Navigate to Other View", e -> {
UI.getCurrent().navigate(OtherView.class);
dialog.close(); // Close the dialog upon navigation
}));
dialog.setHeaderTitle("Moin");
dialog.open();
});`
Activity
AlainaFaisal commentedon Jun 25, 2024
This problem might be occurring because when a RouterLink is used inside a dialog, it tries to navigate as if it's part of the main layout, which is not fully compatible with how dialogs handle their content. Dialogs are generally meant for small, self-contained interactions and are not designed to handle navigation or the lifecycle of routing in the same way as components directly managed by the router.
You can try to change the RouterLink to a Button and manually handle the navigation. This can prevent the default routing behavior that causes the full page reload.
For example this way:
` Button button = new Button("Click me to open dialog with link", event -> {
knoobie commentedon Jun 25, 2024
You are new, so you don't know the full picture here. RouterLink have to work in dialog: see #13270
fix: handle clicks outside container
fix: handle clicks outside container (#19631)
fix: handle clicks outside container (#19631) (#19642)
fix: handle clicks outside container (#19631)