effector / effector/router

[Bug]: Stack navigator cannot push a second instance of the same route

Open
#105 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8
Forks
2
Avg merge
13h 44m
Merged PRs (30d)
1

Description

### Package

@effector/router-react-native

### What happened?

Синхронизация отправляет только `navigate(name, params)` и `StackActions.replace`
(`packages/react-native/lib/navigation-sync.ts`), а `getScreenName` возвращает
path-шаблон, поэтому все экземпляры параметризованного роута отображаются в один
экран React Navigation.

В результате открытие роута, чей экран уже в стеке, не кладёт новый экземпляр:
React Navigation возвращается к существующему и обновляет параметры. Предыдущий
экземпляр теряется, «назад» его пропускает, экран не перемонтируется — работа на
маунте повторно не выполняется.

Ожидается: открытие параметризованного роута при уже открытом другом его
экземпляре кладёт новый экран.
Фактически: переиспользуется существующий, предыдущий экземпляр теряется.

### Reproduction

```ts
const list = createRoute({ path: '/products' });
const product = createRoute({ path: '/product/:id' });
const router = createRouter({ routes: [list, product] });

list.open();
product.open({ params: { id: '1' } });
product.open({ params: { id: '2' } });

// ожидается: /products -> /product/:id (1) -> /product/:id (2)
// фактически: /products -> /product/:id (2)
```
Обойти на стороне приложения нельзя: конфиг навигатора не даёт хука для
стратегии переходов, а ядро не публикует действие истории — RouterAction
доступен только внутри block / beforeNavigate.

### Environment

@effector/router-react-native: 1.1.0
@effector/router: 1.2.0
effector: >=23
React Native: 0.76
React Navigation: >=6
Node.js: 24.x

### Logs / screenshots

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three opens in the issue, then inspect packages/react-native/lib/navigation-sync.ts and the getScreenName path handling. Trace how the navigation action identifies parameterized routes; done means opening ids 1 and 2 leaves both route instances in the stack so going back visits the first one.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.