Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Docs update or support Set and Map out of the box #187

@KatFishSnake

Description

@KatFishSnake

Hey guys,

Thank you for the amazing plugin that saves us so much space and headaches of building our own.

I wanted to share our recent experience that ended up costing us many senior developer hours that in a retrospective could have been avoided.

The core of the issue was this selector, in the scope of our large codebase we would have expected this not to work, especially as it was properly tested and fully functional.

import isEqual from 'lodash/isEqual'
const { someIds } = useSelector(state => ({
    someIds: new Set(state.someIds),
  }),
  isEqual
);

But after the recent introduction of lodash-webpack-plugin it stopped working, the journey to this realization took a surprisingly large amount of time and tears. So I think we can do something for people that yet to discover that if you would not add exotics: true to the plugin configuration, this resolution would not be successful.

I do understand that you already have somewhat of a warning

DISCLAIMER: Using this plugin without enabling the proper feature sets may cause lodash functions to behave in unexpected ways. Methods may appear to work, however they might return incorrect results.

Would you be willing to either:

  • Update the documentation of the exotics flag to explicitly (and visually clear with a large exclamation mark) state that buffers, maps, sets, symbols, typed arrays would not work correctly if this is not set to true, and possibly why it is not true by default
  • Or possibly support Map, and Set out of the box as a prominent member of the recent JS releases (and hardly exotics IMO)

Please let me know i can make the documentation PR update myself, or possibly even the default behaviour update

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions