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

Render children in StructureComponentInner to allow useComponent hook to be used in children #21

Merged
merged 1 commit into from
Jun 22, 2021
Merged

Render children in StructureComponentInner to allow useComponent hook to be used in children #21

merged 1 commit into from
Jun 22, 2021

Conversation

cmdcolin
Copy link
Contributor

@cmdcolin cmdcolin commented Jun 21, 2021

Hi there

I didn't fully test this, but I was trying to use the StructureComponent (e.g. to draw a selection like only amino acids 0-90) but I also wanted to have a hook that had useComponent so I had

const ComponentChild = () => {
    const component = useComponent
    useEffect(() => { /* do stuff with component */ })
}

const OtherThing = () => {
    return <StructureComponent><ComponentChild/></StructureComponent>
}

I believe that the ComponentChild does not get rendered by this however, as console.logs in the function body are never called

This PR tries to address this

@cmdcolin
Copy link
Contributor Author

Let me know if this makes sense. I am trying to add a storybook example but I can't get it to work currently...my code modifications to StructureComponentInner don't seem to get picked up

@gky360
Copy link
Owner

gky360 commented Jun 22, 2021

Thank you for creating a pull request!
I understand your use case. Your changes to the StructureComponentInner seem to be nice.

I'd like to merge this pull request for now. It would be great if you could add a storybook example for this use case when you have time.

@gky360 gky360 merged commit 9640209 into gky360:master Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants