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

The length of key and data source are inconsistent. #64

Closed
ghost opened this issue Apr 1, 2018 · 6 comments
Closed

The length of key and data source are inconsistent. #64

ghost opened this issue Apr 1, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented Apr 1, 2018

DEMO

step.1
In the editor casually modify the content, and then save.

step.2
Click AccordionItem. Pay attention to the change of key.

@ryami333
Copy link
Contributor

ryami333 commented Apr 1, 2018

Gidday @wSLecHayfIeNdock, thanks for trying out react-accessible-accordion.

Could you please be a little more specific about what you're expecting and what you're seeing instead? I had a bit of a fiddle with the Demo you sent, and I can't really see anything unexpected.

@ghost
Copy link
Author

ghost commented Apr 1, 2018

677
@ryami333 Key will increment.
Thank you for your reply.

@ryami333
Copy link
Contributor

ryami333 commented Apr 3, 2018

@wSLecHayfIeNdock there isn't really any relationship between the AccordionItems' IDs (which we call 'uuid's behind the scenes) and React's concept of a key prop. If the uuid matched those keys, then we'd have issues if there was more than one Accordion in the same application.

If you could actually elaborate on what you're trying to achieve here, then I might be able to help you - but I can't tell what you're actually trying to do simply by viewing your screencapture. Could you please tell me (with detail) what your goal is, what you've tried, what you expected and your results were?

@ghost
Copy link
Author

ghost commented Apr 3, 2018

@ryami333 Demo updated, Trouble again look at the demo.

AccordionItems id should not be uuid. Should be user-defined key.

expected: onChange > key={dataKey}

<Accordion onChange={(dataKey) => {}}>
    <AccordionItem key={dataKey}>
    ...
    </AccordionItem>
</Accordion>

@ryami333
Copy link
Contributor

ryami333 commented Apr 3, 2018

I don't know where you've read this - this is not a documented feature of react-accessible-accordion. I'm not sure why you're concerned with what we're using as a unique identifier behind the scenes (because you still haven't explained what you're trying to achieve!). We have even used uuid generators in the past such as this one but we've found that we can achieve the same thing by just incrementing an integer.

I don't see any bug here, so I'm going to close this issue. If you feel inclined to give a detailed, careful and considered description of why you're trying to use our uuids then I might still be able to help you though.

@ryami333 ryami333 closed this as completed Apr 3, 2018
@ryami333
Copy link
Contributor

ryami333 commented Apr 12, 2018

@wSLecHayfIeNdock I wonder whether this issue is what you were communicate with us here? If so, it would be cool to hear your feedback on whether the proposed solution would suit your needs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant