eleven-solutions-common-website-unique-web 3.0.25 → 3.0.27

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.
@@ -35,6 +35,7 @@ const TaxonomyForm = () => {
35
35
  };
36
36
  const queryParams = new URLSearchParams(window.location.search);
37
37
  const id = queryParams.get("id");
38
+ console.log(id);
38
39
  // Fetch taxonomy data if id exists
39
40
  useEffect(() => {
40
41
  if (id) {
@@ -72,10 +73,25 @@ const TaxonomyForm = () => {
72
73
  handleFetchSimilarTaxonomies();
73
74
  }
74
75
  }, [type]);
76
+ // useEffect(() => {
77
+ // if (window.location.pathname === "/taxinomies/taxonomyform") {
78
+ // setIsSimilarTaxonomyOpen(true);
79
+ // }
80
+ // }, []);
75
81
  useEffect(() => {
76
- if (window.location.pathname === "/taxinomies/taxonomyform") {
77
- setIsSimilarTaxonomyOpen(true);
78
- }
82
+ const handleLocationChange = () => {
83
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
84
+ setIsSimilarTaxonomyOpen(true);
85
+ }
86
+ // else {
87
+ // setIsSimilarTaxonomyOpen(false);
88
+ // }
89
+ };
90
+ handleLocationChange();
91
+ window.addEventListener("popstate", handleLocationChange);
92
+ return () => {
93
+ window.removeEventListener("popstate", handleLocationChange);
94
+ };
79
95
  }, []);
80
96
  const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
81
97
  event.preventDefault();
@@ -141,8 +157,17 @@ const TaxonomyForm = () => {
141
157
  console.error("Error checking if taxonomy is multiple:", error);
142
158
  }
143
159
  });
144
- fetchIsMultiple();
145
- }, [location.pathname, type]);
160
+ const handleLocationOrTypeChange = () => {
161
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
162
+ fetchIsMultiple();
163
+ }
164
+ };
165
+ handleLocationOrTypeChange();
166
+ window.addEventListener("popstate", handleLocationOrTypeChange);
167
+ return () => {
168
+ window.removeEventListener("popstate", handleLocationOrTypeChange);
169
+ };
170
+ }, [type]);
146
171
  const handleCancelClick = () => {
147
172
  setType("");
148
173
  setCode("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "3.0.25",
3
+ "version": "3.0.27",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -57,6 +57,8 @@ const TaxonomyForm = () => {
57
57
  const queryParams = new URLSearchParams(window.location.search);
58
58
  const id = queryParams.get("id");
59
59
 
60
+ console.log(id);
61
+
60
62
  // Fetch taxonomy data if id exists
61
63
  useEffect(() => {
62
64
  if (id) {
@@ -101,10 +103,29 @@ const TaxonomyForm = () => {
101
103
  }
102
104
  }, [type]);
103
105
 
106
+ // useEffect(() => {
107
+ // if (window.location.pathname === "/taxinomies/taxonomyform") {
108
+ // setIsSimilarTaxonomyOpen(true);
109
+ // }
110
+ // }, []);
111
+
104
112
  useEffect(() => {
105
- if (window.location.pathname === "/taxinomies/taxonomyform") {
106
- setIsSimilarTaxonomyOpen(true);
107
- }
113
+ const handleLocationChange = () => {
114
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
115
+ setIsSimilarTaxonomyOpen(true);
116
+ }
117
+ // else {
118
+ // setIsSimilarTaxonomyOpen(false);
119
+ // }
120
+ };
121
+
122
+ handleLocationChange();
123
+
124
+ window.addEventListener("popstate", handleLocationChange);
125
+
126
+ return () => {
127
+ window.removeEventListener("popstate", handleLocationChange);
128
+ };
108
129
  }, []);
109
130
 
110
131
  const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
@@ -171,8 +192,20 @@ const TaxonomyForm = () => {
171
192
  }
172
193
  };
173
194
 
174
- fetchIsMultiple();
175
- }, [location.pathname, type]);
195
+ const handleLocationOrTypeChange = () => {
196
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
197
+ fetchIsMultiple();
198
+ }
199
+ };
200
+
201
+ handleLocationOrTypeChange();
202
+
203
+ window.addEventListener("popstate", handleLocationOrTypeChange);
204
+
205
+ return () => {
206
+ window.removeEventListener("popstate", handleLocationOrTypeChange);
207
+ };
208
+ }, [type]);
176
209
 
177
210
  const handleCancelClick = () => {
178
211
  setType("");