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(notice): fix limit 1 on useNotice does not work #708

Merged
merged 4 commits into from
Feb 8, 2024

Conversation

108yen
Copy link
Member

@108yen 108yen commented Feb 6, 2024

Closes #695

Description

fix limit 1 on useNotice does not work

Current behavior (updates)

Setting the limit value to 1 does not limit the number of displays.

New behavior

If the limit is set to 1, only one is displayed.
If an invalid value such as -1 is set for the limit value, it is ignored.

Is this a breaking change (Yes/No): No

Additional Information

NIL

Copy link

changeset-bot bot commented Feb 6, 2024

🦋 Changeset detected

Latest commit: 47794e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@yamada-ui/notice Patch
@yamada-ui/providers Patch
@yamada-ui/react Patch
@yamada-ui/use-media-query Patch
@yamada-ui/test Patch
vite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@illionillion illionillion left a comment

Choose a reason for hiding this comment

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

@108yen
When I press the button quickly and repeatedly, sometimes more than one notice appears, even when the limit value is 1.

If Yamada UI uses framer-motion internally, this may be a bug of it.

2024-02-08.17.25.15.mov

@108yen
Copy link
Member Author

108yen commented Feb 8, 2024

@illionillion
I think it is this isssue.
framer/motion#2462

Removing AnimatePresence in notice-provider.tsx will work correctly.

<AnimatePresence initial={false}>
    {notices.map((notice) => (
      <NoticeComponent key={notice.id} variants={variants} {...notice} />
    ))}
</AnimatePresence>

@illionillion
Copy link
Member

@illionillion I think it is this isssue. framer/motion#2462

Removing AnimatePresence in notice-provider.tsx will work correctly.

<AnimatePresence initial={false}>
    {notices.map((notice) => (
      <NoticeComponent key={notice.id} variants={variants} {...notice} />
    ))}
</AnimatePresence>

@108yen
Thanks.
Please correct it that way.

@108yen
Copy link
Member Author

108yen commented Feb 8, 2024

@illionillion
If you remove AnimatePresence, the bug will be fixed, but the animation won’t be rendered. Is that okay? Since it’s a minor bug, waiting for a fix in framer-motion might be a good idea

notice.mp4

@illionillion
Copy link
Member

@illionillion If you remove AnimatePresence, the bug will be fixed, but the animation won’t be rendered. Is that okay? Since it’s a minor bug, waiting for a fix in framer-motion might be a good idea

notice.mp4

That's not good.
Let's wait for the framer-motion to fix it.
I think it is good to merge.

Copy link
Member

@illionillion illionillion left a comment

Choose a reason for hiding this comment

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

Approved

@hirotomoyamada hirotomoyamada merged commit 8447364 into yamada-ui:main Feb 8, 2024
5 checks passed
@github-actions github-actions bot mentioned this pull request Feb 8, 2024
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.

Limit 1 on useNotice does not work
3 participants