-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: multiple fast navigate calls (#20446)
* fix: multiple fast navigate calls Fix issue where a slow connection and fast `navigate` calls throws exception due to faulty blocker state change. Fixes #20404 * Queue new navigations during ongoing navigation. * fix blocker nav for basepath Add test view for manual testing. Test script doesn't fail on double click. * Remove test class and selenium dependency. --------- Co-authored-by: Mikhail Shabarov <[email protected]>
- Loading branch information
Showing
5 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
flow-tests/test-react-router/src/main/frontend/NavigateView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {useNavigate} from "react-router-dom"; | ||
import { | ||
ReactAdapterElement, | ||
RenderHooks | ||
} from "Frontend/generated/flow/ReactAdapter"; | ||
|
||
class NavigateView extends ReactAdapterElement { | ||
protected render(hooks: RenderHooks): React.ReactElement | null { | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<> | ||
<p id="react">This is a simple view for a React route</p> | ||
<button id="react-navigate" onClick={() => navigate("com.vaadin.flow.RouterView"!)}> | ||
Navigate button | ||
</button> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
customElements.define('navigate-view', NavigateView); |
33 changes: 33 additions & 0 deletions
33
flow-tests/test-react-router/src/main/java/com/vaadin/flow/ReactNavigateView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2000-2024 Vaadin Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.vaadin.flow; | ||
|
||
import com.vaadin.flow.component.Tag; | ||
import com.vaadin.flow.component.dependency.JsModule; | ||
import com.vaadin.flow.component.react.ReactAdapterComponent; | ||
import com.vaadin.flow.router.Route; | ||
|
||
/** | ||
* Test view for vaadin/flow#20404 Set network to slow 4G and quickly click on | ||
* button. No console exceptions should be shown. | ||
*/ | ||
@Route("com.vaadin.flow.ReactNavigateView") | ||
@Tag("navigate-view") | ||
@JsModule("NavigateView.tsx") | ||
public class ReactNavigateView extends ReactAdapterComponent { | ||
|
||
} |