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

feat: new hook useMap #155

Merged
merged 1 commit into from
Jun 24, 2021
Merged

feat: new hook useMap #155

merged 1 commit into from
Jun 24, 2021

Conversation

xobotyi
Copy link
Contributor

@xobotyi xobotyi commented Jun 24, 2021

What new hook does?

Tracks the state of a Map.

Checklist

  • Have you read contribution guideline?
  • Does the code have comments in hard-to-understand areas?
  • Is there an existing issue for this PR?
  • Have the files been linted and formatted?
  • Have the docs been updated?
  • Have the tests been added to cover new hook?
  • Have you run the tests locally to confirm they pass?

@xobotyi xobotyi added the 🎂 new hook New hook added label Jun 24, 2021
@xobotyi xobotyi requested a review from JoeDuncko June 24, 2021 07:59
@codecov
Copy link

codecov bot commented Jun 24, 2021

Codecov Report

Merging #155 (4c8ffa4) into master (c201f10) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #155   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           38        39    +1     
  Lines          608       630   +22     
  Branches       109       110    +1     
=========================================
+ Hits           608       630   +22     
Impacted Files Coverage Δ
src/index.ts 100.00% <100.00%> (ø)
src/useMap/useMap.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c201f10...4c8ffa4. Read the comment docs.

Copy link
Contributor

@JoeDuncko JoeDuncko left a comment

Choose a reason for hiding this comment

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

LGTM

@xobotyi xobotyi merged commit 523dd81 into master Jun 24, 2021
github-actions bot pushed a commit that referenced this pull request Jun 24, 2021
# [3.5.0](v3.4.0...v3.5.0) (2021-06-24)

### Features

* new hook `useMap` ([#155](#155)) ([523dd81](523dd81))
@xobotyi
Copy link
Contributor Author

xobotyi commented Jun 24, 2021

🎉 This PR is included in version 3.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@DanHarman
Copy link

I don't understand why this has a mutable object api in contrast to useList which returns the operations distinct to the list. This makes the library inconsistent?

@xobotyi
Copy link
Contributor Author

xobotyi commented Aug 29, 2022

  1. Сopying a map of 1k numbers is two orders of magnitude slower than copying same size array (like it is slow af).
  2. There is no way of giving an access to a map without making it mutable, Map method mutates its source and there is nothing to do with it.

@DanHarman
Copy link

Understood. I wonder if it would be better to return the proxied apis in the way list does, although then risk of people mutating the map directly without the proxied versions unless they are removed from the returned map. All quite difficult trade offs so I understand your decision now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants