@gustavo-valsechi/client 1.4.288 → 1.4.290
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.
|
@@ -51,6 +51,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
51
51
|
const theme = (0, import_theme.useTheme)();
|
|
52
52
|
const [targets, setTargets] = (0, import_react.useState)([]);
|
|
53
53
|
const [modal, setModal] = (0, import_react.useState)(-1);
|
|
54
|
+
console.log("targets", targets);
|
|
54
55
|
(0, import_react.useEffect)(() => {
|
|
55
56
|
(0, import_events.onScroll)(close, containerRef);
|
|
56
57
|
}, [containerRef]);
|
|
@@ -116,9 +117,11 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
116
117
|
insideMemory.push(index);
|
|
117
118
|
};
|
|
118
119
|
const add = (target) => {
|
|
119
|
-
const
|
|
120
|
-
|
|
120
|
+
const existsInMemory = import_lodash.default.find(memory, (data) => data.ref.current === target.ref.current);
|
|
121
|
+
const existsInTarget = import_lodash.default.find(targets, (data) => data.ref.current === target.ref.current);
|
|
122
|
+
if (existsInMemory || existsInTarget) return;
|
|
121
123
|
memory.push(target);
|
|
124
|
+
console.log("memory", [...memory]);
|
|
122
125
|
setTargets([...memory]);
|
|
123
126
|
};
|
|
124
127
|
const remove = (ref) => {
|
|
@@ -17,6 +17,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
17
17
|
const theme = useTheme();
|
|
18
18
|
const [targets, setTargets] = useState([]);
|
|
19
19
|
const [modal, setModal] = useState(-1);
|
|
20
|
+
console.log("targets", targets);
|
|
20
21
|
useEffect(() => {
|
|
21
22
|
onScroll(close, containerRef);
|
|
22
23
|
}, [containerRef]);
|
|
@@ -82,9 +83,11 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
82
83
|
insideMemory.push(index);
|
|
83
84
|
};
|
|
84
85
|
const add = (target) => {
|
|
85
|
-
const
|
|
86
|
-
|
|
86
|
+
const existsInMemory = _.find(memory, (data) => data.ref.current === target.ref.current);
|
|
87
|
+
const existsInTarget = _.find(targets, (data) => data.ref.current === target.ref.current);
|
|
88
|
+
if (existsInMemory || existsInTarget) return;
|
|
87
89
|
memory.push(target);
|
|
90
|
+
console.log("memory", [...memory]);
|
|
88
91
|
setTargets([...memory]);
|
|
89
92
|
};
|
|
90
93
|
const remove = (ref) => {
|