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

Sign up to get free protection for your applications and to get access to all the features.
@@ -72,10 +72,25 @@ const TaxonomyForm = () => {
72
72
  handleFetchSimilarTaxonomies();
73
73
  }
74
74
  }, [type]);
75
+ // useEffect(() => {
76
+ // if (window.location.pathname === "/taxinomies/taxonomyform") {
77
+ // setIsSimilarTaxonomyOpen(true);
78
+ // }
79
+ // }, []);
75
80
  useEffect(() => {
76
- if (window.location.pathname === "/taxinomies/taxonomyform") {
77
- setIsSimilarTaxonomyOpen(true);
78
- }
81
+ const handleLocationChange = () => {
82
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
83
+ setIsSimilarTaxonomyOpen(true);
84
+ }
85
+ else {
86
+ setIsSimilarTaxonomyOpen(false);
87
+ }
88
+ };
89
+ handleLocationChange();
90
+ window.addEventListener("popstate", handleLocationChange);
91
+ return () => {
92
+ window.removeEventListener("popstate", handleLocationChange);
93
+ };
79
94
  }, []);
80
95
  const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
81
96
  event.preventDefault();
@@ -141,8 +156,17 @@ const TaxonomyForm = () => {
141
156
  console.error("Error checking if taxonomy is multiple:", error);
142
157
  }
143
158
  });
144
- fetchIsMultiple();
145
- }, [location.pathname, type]);
159
+ const handleLocationOrTypeChange = () => {
160
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
161
+ fetchIsMultiple();
162
+ }
163
+ };
164
+ handleLocationOrTypeChange();
165
+ window.addEventListener("popstate", handleLocationOrTypeChange);
166
+ return () => {
167
+ window.removeEventListener("popstate", handleLocationOrTypeChange);
168
+ };
169
+ }, [type]);
146
170
  const handleCancelClick = () => {
147
171
  setType("");
148
172
  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.26",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -101,10 +101,28 @@ const TaxonomyForm = () => {
101
101
  }
102
102
  }, [type]);
103
103
 
104
+ // useEffect(() => {
105
+ // if (window.location.pathname === "/taxinomies/taxonomyform") {
106
+ // setIsSimilarTaxonomyOpen(true);
107
+ // }
108
+ // }, []);
109
+
104
110
  useEffect(() => {
105
- if (window.location.pathname === "/taxinomies/taxonomyform") {
106
- setIsSimilarTaxonomyOpen(true);
107
- }
111
+ const handleLocationChange = () => {
112
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
113
+ setIsSimilarTaxonomyOpen(true);
114
+ } else {
115
+ setIsSimilarTaxonomyOpen(false);
116
+ }
117
+ };
118
+
119
+ handleLocationChange();
120
+
121
+ window.addEventListener("popstate", handleLocationChange);
122
+
123
+ return () => {
124
+ window.removeEventListener("popstate", handleLocationChange);
125
+ };
108
126
  }, []);
109
127
 
110
128
  const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
@@ -171,8 +189,20 @@ const TaxonomyForm = () => {
171
189
  }
172
190
  };
173
191
 
174
- fetchIsMultiple();
175
- }, [location.pathname, type]);
192
+ const handleLocationOrTypeChange = () => {
193
+ if (window.location.pathname === "/taxonomy/taxonomyform") {
194
+ fetchIsMultiple();
195
+ }
196
+ };
197
+
198
+ handleLocationOrTypeChange();
199
+
200
+ window.addEventListener("popstate", handleLocationOrTypeChange);
201
+
202
+ return () => {
203
+ window.removeEventListener("popstate", handleLocationOrTypeChange);
204
+ };
205
+ }, [type]);
176
206
 
177
207
  const handleCancelClick = () => {
178
208
  setType("");