Skip to content

Fix/filter/max depth observable - #3333

Merged
eikeland merged 2 commits into
mainfrom
fix/filter/max-depth-observable
Aug 3, 2026
Merged

Fix/filter/max depth observable#3333
eikeland merged 2 commits into
mainfrom
fix/filter/max-depth-observable

Conversation

@eikeland

@eikeland eikeland commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Why

After upgrading @equinor/fusion-observable, FilterOptionHeader entered an infinite render loop because its inline selector created a new derived observable on every render.

What changed

  • Stabilized the selection-count selector across renders
  • Prevented useObservableState from repeatedly resubscribing
  • Preserved the existing selected-option count behavior
  • Added a patch changeset for @equinor/fusion-react-filter

Validation

  • bun run --cwd packages/filter build
  • Verified the filter renders without the maximum update depth error
  • Biome CI passes

Reference

Related to https://github.com/equinor/fusion/issues/889

@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0318e17

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@equinor/fusion-react-filter Patch
@equinor/fusion-react-components-stories Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eikeland
eikeland marked this pull request as ready for review August 3, 2026 07:12
@eikeland
eikeland requested a review from Copilot August 3, 2026 07:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an infinite render loop introduced after upgrading @equinor/fusion-observable by ensuring FilterOptionHeader uses a stable selector function when deriving the selected-option count from an observable selection set.

Changes:

  • Extracted the selection-size selector into a module-level function to keep selector identity stable across renders.
  • Updated FilterOptionHeader to use the stabilized selector when calling useObservableSelector.
  • Added a patch changeset for @equinor/fusion-react-filter describing the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/filter/src/components/filter/FilterOptionHeader.tsx Stabilizes the selector function passed to useObservableSelector to avoid re-creating derived observables each render.
.changeset/stable-filter-selector.md Adds a patch changeset documenting the render-loop fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eikeland
eikeland merged commit 854843f into main Aug 3, 2026
7 of 9 checks passed
@eikeland
eikeland deleted the fix/filter/max-depth-observable branch August 3, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants