fix: Refresh breaks open tabs (#39021)

## Description

Fixes a focus retention issue where on refresh, the tabs are lost


EE Shadow: https://github.com/appsmithorg/appsmith-ee/pull/6106


## Automation

/ok-to-test tags="@tag.IDE"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13151485815>
> Commit: e7ed2c3c16b1673b46a3bec68a7317e51bfbd575
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13151485815&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IDE`
> Spec:
> <hr>Wed, 05 Feb 2025 06:53:31 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

This update delivers enhanced navigation stability and focus management
for a smoother browsing experience.

- **Bug Fixes**
- Improved focus handling during navigation transitions by ensuring
adjustments occur only when returning from a valid page. This refinement
minimizes unintended focus shifts, providing a more consistent and
user-friendly interface.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Hetu Nandu 2025-02-05 12:23:42 +05:30 committed by GitHub
parent 1de24080a5
commit 44d2b7e912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,12 +38,14 @@ export function* handleRouteChange(
yield fork(watchForTrackableUrl, action.payload);
const IDEType = getIDETypeByUrl(pathname);
yield fork(
FocusRetention.onRouteChange.bind(FocusRetention),
pathname,
previousPath,
state,
);
if (previousPath) {
yield fork(
FocusRetention.onRouteChange.bind(FocusRetention),
pathname,
previousPath,
state,
);
}
if (IDEType === IDE_TYPE.App) {
yield fork(logNavigationAnalytics, action.payload);