Skip to content

fix: stabilize useLayer references - #5272

Draft
nynexman4464 wants to merge 1 commit into
mainfrom
fix/stabilize-use-layer
Draft

fix: stabilize useLayer references#5272
nynexman4464 wants to merge 1 commit into
mainfrom
fix/stabilize-use-layer

Conversation

@nynexman4464

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: three identity tests fail on main
  • pnpm vitest run packages/core/src/Layer/useLayer.test.tsx — 46 passed
  • pnpm -F @astryxdesign/core build
  • focused ESLint, formatting, sync, and changeset checks

@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 20, 2026 11:48pm

Request Review

@github-actions

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 797 -
Complexity N/A Very High (86) -

Bundle Size Summary

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

Accessibility Audit

Status: No accessibility violations detected.


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

github-actions Bot added a commit that referenced this pull request Aug 21, 2026
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.

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