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

Fix/tombo/responsive list issues #173

Merged
merged 2 commits into from
Jul 25, 2021

Conversation

mentaman
Copy link
Contributor

@mentaman mentaman commented Jul 25, 2021

There were a few issues with the ResponsiveList we found, that caused it to break sometime and draw too much items.
image

  1. It didn't draw items that it didn't have place for, so after it calculated their width once,
    it wouldn't be able to calculate it again.
    since the children here would include only part of the children
    image

  2. If there were new items added after drawing it, it wouldn't be able to calculate the widthes for the same reason and it'll break

To solve it, I'm drawing it twice now, once for calculation only invisibly with position absolute with the parent width,
and once the actual drawing.

menuButtonProps
},
ref
) => {
const componentRef = useRef(null);
const mergedRef = useMergeRefs({ refs: [ref, componentRef] });
const index = useElementsOverflowingIndex({ ref: componentRef, children, paddingSize, resizeDebounceTime });
const index = useElementsOverflowingIndex({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I saw we're the only one using ResponsiveList and useElementsOverflowingIndex
so there's no risk of breaking changes right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is open source, so it not known, but this is still a work in progress, i don't mind changing it

}


export const ChangeChildrenCheck = () => {
Copy link
Contributor Author

@mentaman mentaman Jul 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the fix, this story is broken.
If you prefer another solution and want to reproduce the bug,
you can copy the stories file here and open this story.

menuButtonProps
},
ref
) => {
const componentRef = useRef(null);
const mergedRef = useMergeRefs({ refs: [ref, componentRef] });
const index = useElementsOverflowingIndex({ ref: componentRef, children, paddingSize, resizeDebounceTime });
const index = useElementsOverflowingIndex({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is open source, so it not known, but this is still a work in progress, i don't mind changing it

@orrgottlieb orrgottlieb merged commit 861314a into master Jul 25, 2021
@orrgottlieb orrgottlieb deleted the fix/tombo/responsive-list-issues branch July 25, 2021 07:18
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