Skip to content

fix: stabilize useLayer references - #5272

Merged
nynexman4464 merged 1 commit into
mainfrom
fix/stabilize-use-layer
Aug 27, 2026
Merged

nynexman4464 merged 1 commit into
mainfrom
fix/stabilize-use-layer

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • keep the context trigger ref returned by useLayer stable across unrelated rerenders
  • memoize the context and fixed API objects from their exposed members
  • preserve updates when callbacks, open state, or render behavior actually change
  • add regression coverage for stable refs and return objects

Fixes #5271.

Test plan

  • fail-first on current main: the three identity tests fail (3 failed, 43 passed)
  • pnpm vitest run packages/core/src/Layer/useLayer.test.tsx — 46 passed
  • pnpm lint:strict
  • pnpm build
  • pnpm vitest run --maxWorkers=8 — 12,226 passed, 5 skipped

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 20, 2026
@vercel

vercel Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 27, 2026 4:37pm

Request Review

@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Layer (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1376 -
Complexity N/A Very High (100) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

82 added · 0 removed. View the report

To accept these exact frames: /accept-visual 33093725183/1 <reason>

Added — After
Added — After visual regression frame

Added — After
Added — After visual regression frame

Added — After
Added — After visual regression frame


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Aug 21, 2026
@nynexman4464
nynexman4464 force-pushed the fix/stabilize-use-layer branch from d9734ff to fb34896 Compare August 25, 2026 18:54
github-actions Bot added a commit that referenced this pull request Aug 25, 2026
@nynexman4464
nynexman4464 marked this pull request as ready for review August 25, 2026 19:30
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/accept-visual 33093725183/1 The change only stabilizes ref and return-object identity; these added Layer frames establish the missing baseline without an intended visual change.

github-actions Bot added a commit that referenced this pull request Aug 27, 2026
@github-actions github-actions Bot added the visual-approved Current visual bundle has an explicit acceptance record label Aug 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Visual changes accepted for abab3ca7f6c1. A new push invalidates this approval; after merge, the reviewed AFTER frames must reproduce before the baseline is promoted.

@nynexman4464
nynexman4464 merged commit f67544e into main Aug 27, 2026
24 of 25 checks passed
@nynexman4464
nynexman4464 deleted the fix/stabilize-use-layer branch August 27, 2026 17:02
github-actions Bot added a commit that referenced this pull request Aug 27, 2026

This branch was successfully deployed

1 active deployment
Preview — abab3ca7 Deployed Aug 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. visual-approved Current visual bundle has an explicit acceptance record

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] useLayer recreates trigger refs and API objects on every render

1 participant