-
Notifications
You must be signed in to change notification settings - Fork 1k
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
AccordionTab cannot be used in custom wrapper #2052
Comments
Same issue here |
Same issue here |
Same problem here. This broke our app after upgrading. |
I wonder if instead of |
I think it will not help. The same issue with |
It may help if your wrapper component is a class component that extends the |
Any progress on this front? Any known workarounds, perhaps? |
Hi, Sorry for the delayed response! This structure has already changed. Please see; You can add __TYPE="AccordionTab" prop to your custom AccordionTab component. Exp;
I have tagged this issue as "Resolved" for now. If a new update comes from your side, please reopen this ticket. Thanks a lot for your understanding! |
@mertsincan I don't manage to make that work: https://codesandbox.io/s/primereact-test-forked-drc2vg?file=/src/index.js Having custom props is also not currently possible. |
@mertsincan @melloware sorry for the spam, but I'm not sure whether you got a notification from the previous message, since the ticket is closed and I only added the mention in an edit. Could you please confirm that you got my message, and maybe change the ticket's status? Thank you! 🙂 |
Hi @inad9300, Sorry for the confusion! React provides us with methods that allow selecting only child elements. We do not know what will be returned from any function or class base components, and we cannot access the instances of the returned components from the DOM tree. This is about React. It allows us to reach only children with props.children. You can try this by creating a similar structure without the Accordion component. |
I'm sorry, I don't think I fully follow. Are you simply saying that fixing the problem is not so easy because of a limitation in React? Does this mean you will be working on the issue, or not? My guess of where the problem lies would be that |
Did you have a chance to give this any more thought? 🙂 |
@inad9300 I don't have it fully working but I have it "closer". Check out my example: https://codesandbox.io/s/primereact-test-forked-hh2sy5?file=/src/index.js |
Thanks for sharing – great progress! |
@melloware How's the work on this going? One thought I had about this topic is that a toggleable Panel component is basically an AccordionTab, except panels can already be extracted to separate components without a problem. From this point of view, one could implement an accordion based on panels. Maybe this is something that Accordion can do internally, or at least something that could be used as inspiration to improve Accordion. Not to put any pressure on you, but it would be great if you could give an estimation of when you think this ticket might be addressed, independent of the particular solution. This is simply for me to decide whether to attempt my own accordion implementation based on panels, or to wait for PrimeReact's fix. |
@inad9300 I don't work for PrimeTek I am just an open source volunteer. If you need this level of support I suggest you look into PRO support. I think this component would need to be refactored to make it possible. |
Wow – first of all, props to you for all of your hard work! That said, I find it a little concerning that a) you are not getting compensated for it (though I'm only assuming here, of course) and b) PrimeTek's work on PrimeReact seems negligible in comparison to your contributions. I mean, it would seem that you are the one sailing this boat! 😄 While PRO isn't for me yet, I did base my choice of PrimeReact on the fact that there was a company backing it, knowing that I could opt in to PRO if I ever needed it. But now I'm finding that maybe there isn't that much backing from PrimeTek's side? It'd be nice if PrimeTek could comment on this, particularly on how invested they are in PrimeReact (in general, and also versus their efforts in other frameworks). |
@inad9300 PrimeReact is here to stay. I have Fortune 500 clients I use it at so I am personally vested in making sure its great and stays great. That being said PrimeTek has a lot of efforts going on and right now. They are updating PrimeVue for ARIA and once that is complete they are going to roll all those changes into PrimeReact 9. So, while it looks like there is no activity from PrimeTek they are quite active! |
Hi @inad9300, @melloware is a Member of the PrimeReact and PrimeFaces Teams. He really does great work. We are very happy to see him in the team. While making decisions about the changes to be made in the library, we talk within the team and implement accordingly and provide feedback on bugs. Accordingly, any team member can implement it. PrimeReact is currently managed by Melloware. Also, 2 more developers joined the PrimeReact team. So it's perfectly normal for everyone on the team to take on such a role. As you know, apart from community support, other PrimeReact products such as Layout, Designer and Blocks need to constantly renew themselves. New members of the team are currently taking part in these projects. They also really stepped us up on PRO support. As a result, our goal is always to optimize PrimeReact. Let's get back to your problem. The __TYPE property is actually a property that should only be used to find the correct helper components. As you can see in Melloware's work, the returned by a custom component doesn't matter. Even removing it and just putting {props.children} will give the same result. As I said before, React only allows us to find the children of the parent component. It won't let us find it until his grandchildren. In short, we have no direct access to the parent's descendants. In order to get the result you want, AccordionTab needs to render itself. This means moving some code from Accordion to AccordionTab. This might make sense at first, but be aware of the changes in how such a change interacts with Accordion. Even moving some events there will require constant communication with both their children and siblings. We've tried this kind of experiment before with our other libraries and it was a really annoying process. It caused too many problems :) That's why all components of Prime* were designed that way. Actually, as far as I understand in your topic, you want to design AccordionTab according to some special operations. I think you can create dynamic accordionTabs for this. Exp; |
Thanks a lot for the explanation; it gives me much peace of mind 🙂 It's good to know about the dynamic tabs possibility. In the end I went the route I hinted to in a previous comment and implemented what I wanted using toggleable panels, which are working well. |
Glad to hear, thanks a lot for the update! If you have any questions, please don't hesitate to ask. I'll try to answer before @melloware 🙂🙂 |
@mertsincan @melloware |
I will add a showcase example @Traveller23 |
any solution? @melloware @mertsincan @kazamov @Fallup @inad9300
Storybook:
Problem: When using FilterAccordionTab inside FilterAccordion, the tabs do not render their content - I don't see nothing on the screen. When using PrimeAccordionTab inside FilterAccordion, it works as expected. What I Tried: Verified that children are being passed correctly in both FilterAccordion and FilterAccordionTab. Checked the structure and props of both FilterAccordionTab and PrimeAccordionTab. Added console logs to check the rendering flow (but no logs are shown). Expected Behavior: FilterAccordionTab should render the content just like PrimeAccordionTab. Observed Behavior: FilterAccordionTab does not render any content inside FilterAccordion. Additional Details: Using PrimeReact for the accordion components. The issue is only with the custom FilterAccordionTab. Storybook setup is correctly configured and renders other components without issues. Any insights or suggestions to resolve this would be greatly appreciated. Thank you! |
@adirzoari you can't as explained in the ticket the AccordionTab itself is not a component. |
@melloware what the options I have? just map each component as in the example? |
Not sure without research or just go back to using a regular Accordion and AccordionTab. |
Current behavior
We use AccordionTab component in a custom wrapper (Accordion is wrapped as well). After recent change - f63a13a - accordion tabs are not displayed anymore because of type mismatch.
Expected behavior
We would like to still use Accordion in custom wrapper
Minimal reproduction of the problem with instructions
We have something like code below in our app:
The type of our wrapper is not equal to AccordionTab so tabs are not rendered at all.
Please tell us about your environment:
Browser: all
Language: TypeScript 4.2.4
The text was updated successfully, but these errors were encountered: