Skip to content

use-set does not update for .union method #7981

@XCanG

Description

@XCanG

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

8.1.0

What package has an issue?

@mantine/hooks

What framework do you use?

Vite

In which browsers you can reproduce the issue?

All

Describe the bug

Set have various methods and mantine is hooked well for .add method, but if I use .union it does not update state.

Short example:

import { useSet } from "@mantine/hooks"
// ...
const mySet = useSet([1, 2, 3])
// ...
useEffect(() => {
    const otherSet = new Set([3, 4, 5])
    // don't work example:
    mySet.union(otherSet)

    // work:
    otherSet.forEach((item) => mySet.add(item))
}, [])

useEffect(console.log, [mySet])

If possible, include a link to a codesandbox with a minimal reproduction

No response

Possible fix

Probably need to hook similarly as to .add method.

Self-service

  • I would be willing to implement a fix for this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedCompleted issues that will be published with next patch (1.0.X)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions