@folklore/socket 0.4.24 → 0.4.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs.js CHANGED
@@ -827,11 +827,15 @@ function SocketContainer(_ref) {
827
827
  }, [updateChannels]);
828
828
  const removeToChannelsCount = React.useCallback(newChannels => {
829
829
  channelsCountRef.current = newChannels.reduce((map, channel) => {
830
- const newCount = (map[channel] || 0) - 1;
830
+ const {
831
+ [channel]: currentCount = 0,
832
+ ...otherCount
833
+ } = map;
834
+ const newCount = (currentCount || 0) - 1;
831
835
  return newCount > 0 ? {
832
- ...map,
836
+ ...otherCount,
833
837
  [channel]: newCount
834
- } : map;
838
+ } : otherCount;
835
839
  }, channelsCountRef.current);
836
840
  updateChannels(Object.keys(channelsCountRef.current));
837
841
  }, [updateChannels]);
package/dist/es.js CHANGED
@@ -823,11 +823,15 @@ function SocketContainer(_ref) {
823
823
  }, [updateChannels]);
824
824
  const removeToChannelsCount = useCallback(newChannels => {
825
825
  channelsCountRef.current = newChannels.reduce((map, channel) => {
826
- const newCount = (map[channel] || 0) - 1;
826
+ const {
827
+ [channel]: currentCount = 0,
828
+ ...otherCount
829
+ } = map;
830
+ const newCount = (currentCount || 0) - 1;
827
831
  return newCount > 0 ? {
828
- ...map,
832
+ ...otherCount,
829
833
  [channel]: newCount
830
- } : map;
834
+ } : otherCount;
831
835
  }, channelsCountRef.current);
832
836
  updateChannels(Object.keys(channelsCountRef.current));
833
837
  }, [updateChannels]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/socket",
3
- "version": "0.4.24",
3
+ "version": "0.4.25",
4
4
  "description": "Socket utilities",
5
5
  "keywords": [
6
6
  "javascript",
@@ -56,5 +56,5 @@
56
56
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
57
57
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
58
58
  },
59
- "gitHead": "b6a18894ee220306fc027de04e02e08f1f60b1ba"
59
+ "gitHead": "5aef43ea2ccd8a24ce2f64f6a47b53262c58e586"
60
60
  }