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

Latest preact version breaks @radix-ui/react-switch and application #4590

Closed
ndt080 opened this issue Dec 3, 2024 · 4 comments
Closed

Latest preact version breaks @radix-ui/react-switch and application #4590

ndt080 opened this issue Dec 3, 2024 · 4 comments
Labels
needs-more-info The issue doesn't contain enough information to be able to help

Comments

@ndt080
Copy link

ndt080 commented Dec 3, 2024

preact@^10.25.0 (it has also been checked on 10.25.1)

Describe the bug
When trying to create a component, the page freezes. There is no memory leak in devtools, but the rendering process does not continue

Everything works fine on version 10.24.3

@JoviDeCroock
Copy link
Member

JoviDeCroock commented Dec 3, 2024

Hey,

Mind adding a reproduction as the issue template demands? I'm mainly asking because when I leverage the basic version of this library in 10.24.3 it seems to also bail out 😅

afaict this can never work for > 2 clicks due to an erroneous use of a Property Setter on an HTML node.

    const input = ref.current;
    const inputProto = window.HTMLInputElement.prototype;
    const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
    const setChecked = descriptor.set;
    if (prevChecked !== checked && setChecked) {
      const event = new Event("click", { bubbles });
      setChecked.call(input, checked);
			console.log('dispatching event')
      input.dispatchEvent(event);
    }

@JoviDeCroock JoviDeCroock added the needs-more-info The issue doesn't contain enough information to be able to help label Dec 3, 2024
@ndt080
Copy link
Author

ndt080 commented Dec 4, 2024

@JoviDeCroock Hi, I tried to reproduce the problem in StackBlitz with pure Switch usage and I failed. I have a really large and complex application. After updating to 10.25.0/10.25.1, my application began to freeze at the time of rendering the UI. Experimentally, commenting on the components, I found that the hang causes @radix-ui/switch. Asynchronous operations, memoization, fragments, or suspense may be affected. I need a little more time to reproduce the problem in a clean environment.

@JoviDeCroock
Copy link
Member

JoviDeCroock commented Dec 4, 2024

@ndt080 you can also try running a git bisect yourself to see which change broke it. My gut feel tells me to check out #4560

@ndt080
Copy link
Author

ndt080 commented Dec 19, 2024

As it turned out, the problem was not with @radix-ui/*. I wrapped all dynamic component inserts in Suspense and the problem was resolved.

function SomeComponent({ ButtonComponent }) {
return <div><Suspense fallback={null}><ButtonComponent /></Suspense ></div>
}

I think, this issue can be closed

@ndt080 ndt080 closed this as completed Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-more-info The issue doesn't contain enough information to be able to help
Projects
None yet
Development

No branches or pull requests

2 participants