effector / effector/router

route.updated event with value-based deduplication

Open
#62 0 comments 0 reactions 0 assignees View on GitHub
atomic-router feature parity enhancement scope:core
Dominant language
TypeScript
Stars
8
Forks
2
Avg merge
13h 44m
Merged PRs (30d)
1

Description

### Problem

atomic-router routes expose `updated` — fired when a route stays open but its params/query change (e.g. navigating `/user/1` → `/user/2`). `@effector/router` has no equivalent: the only workaround is watching `$params`, which (per #43) currently also fires on identical values, so there is no reliable "the route content must refresh" signal.

### Proposed solution

Add `route.updated: Event>` to every route (path, pathless, virtual). Semantics: fires only when `$isOpened` is already `true` **and** the incoming `params`/`query` actually differ from the current ones (value-based comparison with normalization, so `1` vs `'1'` does not count as a change — same approach as atomic-router's `paramsEqual`). First open emits only `opened`, never `updated`. Wiring point: the `forceOpenParentFx.doneData` action in `create-route.ts`, where `$params` and `openedOnServer/Client` are already resolved.

Related: #43 — the same comparison helper should back a `$params` update filter.

### Alternatives considered

`sample({ clock: route.$params })` — fires on first open too and on identical values; every consumer reimplements dedupe by hand.

### Package

`@effector/router` (core)

Contributor guide

Open the contributing guide

Research direction

In create-route.ts, inspect the forceOpenParentFx.doneData action where $params and openedOnServer/Client are resolved; compare the existing atomic-router paramsEqual approach and related #43 context. Done means every path, pathless, and virtual route exposes route.updated only for an already-open route whose normalized params/query values changed, while first open emits only opened.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.