@gustavo-valsechi/client 1.4.50 → 1.4.51

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.
@@ -39,9 +39,10 @@ var import_styles = require("./styles");
39
39
  var import_lodash = __toESM(require("lodash"));
40
40
  const TargetContext = (0, import_react.createContext)({});
41
41
  const memory = [];
42
- const show = [];
42
+ const showMemory = [];
43
43
  const TargetProviderContainer = ({ children }) => {
44
44
  const [targets, setTargets] = (0, import_react.useState)([]);
45
+ const [show, setShow] = (0, import_react.useState)([]);
45
46
  (0, import_react.useEffect)(() => {
46
47
  import_lodash.default.forEach(targets, (target, index) => {
47
48
  var _a;
@@ -50,10 +51,12 @@ const TargetProviderContainer = ({ children }) => {
50
51
  element.addEventListener("click", () => {
51
52
  const isShow = import_lodash.default.find(show, (data) => data.index === index);
52
53
  if (isShow) {
53
- show.slice(index, 1);
54
+ showMemory.slice(index, 1);
55
+ setShow(showMemory);
54
56
  return;
55
57
  }
56
- show.push({ index, coords: getCoords(element) });
58
+ showMemory.push({ index, coords: getCoords(element) });
59
+ setShow(showMemory);
57
60
  });
58
61
  });
59
62
  }, [targets]);
@@ -5,9 +5,10 @@ import { Container } from "./styles";
5
5
  import _ from "lodash";
6
6
  const TargetContext = createContext({});
7
7
  const memory = [];
8
- const show = [];
8
+ const showMemory = [];
9
9
  const TargetProviderContainer = ({ children }) => {
10
10
  const [targets, setTargets] = useState([]);
11
+ const [show, setShow] = useState([]);
11
12
  useEffect(() => {
12
13
  _.forEach(targets, (target, index) => {
13
14
  var _a;
@@ -16,10 +17,12 @@ const TargetProviderContainer = ({ children }) => {
16
17
  element.addEventListener("click", () => {
17
18
  const isShow = _.find(show, (data) => data.index === index);
18
19
  if (isShow) {
19
- show.slice(index, 1);
20
+ showMemory.slice(index, 1);
21
+ setShow(showMemory);
20
22
  return;
21
23
  }
22
- show.push({ index, coords: getCoords(element) });
24
+ showMemory.push({ index, coords: getCoords(element) });
25
+ setShow(showMemory);
23
26
  });
24
27
  });
25
28
  }, [targets]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.50",
3
+ "version": "1.4.51",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",