Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: refObj returned from useRef is not sealed #28884

Open
Ahmed-Abou-Emran opened this issue Apr 20, 2024 · 0 comments
Open

Bug: refObj returned from useRef is not sealed #28884

Ahmed-Abou-Emran opened this issue Apr 20, 2024 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@Ahmed-Abou-Emran
Copy link

React version: ^18.0.0

Steps To Reproduce

  1. Create a ref using useRef.
  2. Trying to delete the current property or add a new property.
    image

Link to code example: https://codesandbox.io/p/sandbox/funny-sid-pm6xzq?file=%2Fsrc%2FApp.js%3A12%2C41

The current behavior

The current property is deleted, and a new property is added when trying to add it to the ref Object

The expected behavior

ref Object is sealed, so we should only be allowed to change its current value but not being able to delete it or add a new property to the object.

both createRef and useRef are sealed but only the ref object returned from createRef is selaed:

useRef:mountRef : link

createRef: Link

@Ahmed-Abou-Emran Ahmed-Abou-Emran added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant