Skip to content

Commit

Permalink
apply review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollovati committed Nov 26, 2024
1 parent 4ef3417 commit 2d0834e
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,14 @@ private UIRefreshStrategy computeRefreshStrategy(UI ui,
.isAssignableFrom(chainItem.getClass())))
.distinct().toList();

UIRefreshStrategy refreshStrategy;
// A full chain refresh should be triggered if there are modal
// components, since they could be attached to UI or parent layouts
boolean hasModalComponents = ui.hasModalComponent();
UIRefreshStrategy refreshStrategy;
if (!targetChainChangedItems.isEmpty()) {
refreshStrategy = targetChainChangedItems.stream().allMatch(
chainItem -> chainItem == route && !hasModalComponents)
if (ui.hasModalComponent()) {
refreshStrategy = UIRefreshStrategy.PUSH_REFRESH_CHAIN;
} else if (!targetChainChangedItems.isEmpty()) {
refreshStrategy = targetChainChangedItems.stream()
.allMatch(chainItem -> chainItem == route)
? UIRefreshStrategy.PUSH_REFRESH_ROUTE
: UIRefreshStrategy.PUSH_REFRESH_CHAIN;
} else {
Expand All @@ -365,6 +366,7 @@ private UIRefreshStrategy computeRefreshStrategy(UI ui,
refreshStrategy = computeRefreshStrategyForUITree(ui,
changedClasses, targetsChain, route);
}

// A different layout might have been applied after hotswap
if (refreshStrategy == UIRefreshStrategy.SKIP) {
RouteRegistry registry = ui.getInternals().getRouter()
Expand Down

0 comments on commit 2d0834e

Please sign in to comment.