Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Refactor]: Improve internal code and structure #1445

Closed
zernonia opened this issue Nov 22, 2024 · 0 comments
Closed

[Refactor]: Improve internal code and structure #1445

zernonia opened this issue Nov 22, 2024 · 0 comments

Comments

@zernonia
Copy link
Member

          What I would like to see in Radix-vue and what I am trying to implement in my fork [perigee-ui](https://github.com/perigee-ui)
  1. I use let variables or useRef where React uses useRef. Radix-vue creates unnecessary reactive ref variables in all places, which is completely unnecessary.

  2. I use the composeEventHandlers hook. This hook allows canceling events through preventDefault. Unfortunately, in Vue, handlers received from the parent component end up at the end of the array and are called last (I might have misunderstood the code, there may be inaccuracies).

  3. I use attribute inheritance instead of redefining them in each component, generating unnecessary code. Moreover, it seems that Volar now has typing for attrs. This approach may change if it turns out to be inconvenient to use.

  4. I do not use their useForwardExpose. A hook that replaces the original expose object to pass props outside. Why, if access to them is already available.

  5. I do not use asChild for implementing primitives. Instead, I wrap the component's content in a hook and use it. I thought it was a bit cumbersome to use so many empty wrapper components when they can be eliminated. For example, the FocusScope wrapper is 3 components: FocusScope -> Primitive -> Slot. If there are 3 such wrappers, it is already a tree of 9+ components.
    This is currently a test implementation.

  6. I think it's unlikely. In the distant future, there is a thought to abandon components and leave only hooks that return props. For example, like in Zag and Melt. If the Vapor mod comes out in our lifetime, this method will allow us to get rid of Primitive and Slot

  7. Different implementation of Collection without Map, VDom. Radix vue

  8. Presence is just a hook for me. The same approach was found in Solid's Kobalte. In radix-vue, it is the reason for the absence of content on the first render in components like Accordion.

  9. Availability of component context export for access in user code. It seems that this was promised to be added in Radix v2. I am not following.

  10. No empty wrappers that do nothing.

  11. An easier way to get the current element without computed. Radix-vue

  12. Scoped Context WIP Link Link

Originally posted by @teleskop150750 in #908 (comment)

@unovue unovue locked and limited conversation to collaborators Nov 22, 2024
@zernonia zernonia converted this issue into discussion #1446 Nov 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant