@gustavo-valsechi/client 1.4.289 → 1.4.291
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.
|
@@ -117,13 +117,15 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
117
117
|
insideMemory.push(index);
|
|
118
118
|
};
|
|
119
119
|
const add = (target) => {
|
|
120
|
-
const
|
|
121
|
-
|
|
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;
|
|
122
123
|
memory.push(target);
|
|
123
|
-
console.log("memory", [...memory]);
|
|
124
|
+
console.log("memory add", [...memory]);
|
|
124
125
|
setTargets([...memory]);
|
|
125
126
|
};
|
|
126
127
|
const remove = (ref) => {
|
|
128
|
+
console.log("memory remove", [...memory]);
|
|
127
129
|
const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
|
|
128
130
|
if (!theme.content.isMobile) removeInside(index);
|
|
129
131
|
memory.splice(index, 1);
|
|
@@ -83,13 +83,15 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
83
83
|
insideMemory.push(index);
|
|
84
84
|
};
|
|
85
85
|
const add = (target) => {
|
|
86
|
-
const
|
|
87
|
-
|
|
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;
|
|
88
89
|
memory.push(target);
|
|
89
|
-
console.log("memory", [...memory]);
|
|
90
|
+
console.log("memory add", [...memory]);
|
|
90
91
|
setTargets([...memory]);
|
|
91
92
|
};
|
|
92
93
|
const remove = (ref) => {
|
|
94
|
+
console.log("memory remove", [...memory]);
|
|
93
95
|
const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
|
|
94
96
|
if (!theme.content.isMobile) removeInside(index);
|
|
95
97
|
memory.splice(index, 1);
|