@gustavo-valsechi/client 1.4.313 → 1.4.316

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.
@@ -44,8 +44,8 @@ var import_navigation = require("next/navigation");
44
44
  var import_lodash = __toESM(require("lodash"));
45
45
  var import_modal = __toESM(require("./modal"));
46
46
  const TargetContext = (0, import_react.createContext)({});
47
- const memory = [];
48
- const insideMemory = [];
47
+ let memory = [];
48
+ let insideMemory = [];
49
49
  const TargetProviderContainer = ({ children }) => {
50
50
  const inputRef = (0, import_react.useRef)([]);
51
51
  const containerRef = (0, import_react.useRef)([]);
@@ -74,17 +74,8 @@ const TargetProviderContainer = ({ children }) => {
74
74
  (0, import_react.useEffect)(() => {
75
75
  const removeTarget = (node) => {
76
76
  if (!(node instanceof HTMLElement)) return;
77
- const index = import_lodash.default.findIndex(memory, (target) => {
78
- return target.ref.current === node || node.contains(target.ref.current);
79
- });
80
- console.log(node);
81
- console.log(import_lodash.default.find(memory, (target) => {
82
- return target.ref.current === node || node.contains(target.ref.current);
83
- }));
84
- console.log(index);
85
- if (index === -1) return;
86
- removeInside(index);
87
- memory.splice(index, 1);
77
+ memory = import_lodash.default.filter(memory, (target) => !!target.ref.current);
78
+ insideMemory = [];
88
79
  setTargets([...memory]);
89
80
  };
90
81
  const observer = new MutationObserver((mutations) => {
@@ -10,8 +10,8 @@ import { usePathname } from "next/navigation";
10
10
  import _ from "lodash";
11
11
  import Modal from "./modal";
12
12
  const TargetContext = createContext({});
13
- const memory = [];
14
- const insideMemory = [];
13
+ let memory = [];
14
+ let insideMemory = [];
15
15
  const TargetProviderContainer = ({ children }) => {
16
16
  const inputRef = useRef([]);
17
17
  const containerRef = useRef([]);
@@ -40,17 +40,8 @@ const TargetProviderContainer = ({ children }) => {
40
40
  useEffect(() => {
41
41
  const removeTarget = (node) => {
42
42
  if (!(node instanceof HTMLElement)) return;
43
- const index = _.findIndex(memory, (target) => {
44
- return target.ref.current === node || node.contains(target.ref.current);
45
- });
46
- console.log(node);
47
- console.log(_.find(memory, (target) => {
48
- return target.ref.current === node || node.contains(target.ref.current);
49
- }));
50
- console.log(index);
51
- if (index === -1) return;
52
- removeInside(index);
53
- memory.splice(index, 1);
43
+ memory = _.filter(memory, (target) => !!target.ref.current);
44
+ insideMemory = [];
54
45
  setTargets([...memory]);
55
46
  };
56
47
  const observer = new MutationObserver((mutations) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.313",
3
+ "version": "1.4.316",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",