@buerokratt-ria/common-gui-components 0.0.32 → 0.0.33

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All changes to this project will be documented in this file.
4
4
 
5
5
  ## Template [MajorVersion.MediterraneanVersion.MinorVersion] - DD-MM-YYYY
6
6
 
7
+ ## [0.0.33] - 22.12.2025
8
+
9
+ - Updated domain logic change
10
+ - Added abort ref to cancel unnecessary api calls.
11
+
7
12
  ## [0.0.32] - 19-11-2025
8
13
 
9
14
  - Fixed isTest Mark.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/common-gui-components",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "Common GUI components and pre defined templates.",
5
5
  "main": "index.ts",
6
6
  "author": "ExiRai",
@@ -124,6 +124,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
124
124
  const envVal = import.meta.env.REACT_APP_SHOW_TEST_CONVERSATIONS;
125
125
  const showTest = envVal === undefined ? true : envVal.toLowerCase() === 'true';
126
126
  const [loading, setLoading] = useState(false);
127
+ const abortRef = useRef<AbortController | null>(null);
127
128
 
128
129
  const parseDateParam = (dateString: string | null) => {
129
130
  if (!dateString) return new Date();
@@ -158,13 +159,20 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
158
159
  });
159
160
  }, 500);
160
161
 
161
- if (multiDomainEnabled) {
162
- useStore.subscribe((state, prevState) => {
163
- if (JSON.stringify(state.userDomains) !== JSON.stringify(prevState.userDomains)) {
164
- setUpdateKey(prevState => prevState + 1);
162
+ useEffect(() => {
163
+ if (!multiDomainEnabled) return;
164
+
165
+ const unsubscribe = useStore.subscribe((state, prevState) => {
166
+ if (
167
+ JSON.stringify(state.userDomains) !==
168
+ JSON.stringify(prevState.userDomains)
169
+ ) {
170
+ setUpdateKey((v) => v + 1);
165
171
  }
166
172
  });
167
- }
173
+
174
+ return () => unsubscribe();
175
+ }, [multiDomainEnabled, useStore]);
168
176
 
169
177
  useEffect(() => {
170
178
  if (passedChatId != null) {
@@ -292,6 +300,9 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
292
300
  sorting: SortingState;
293
301
  search: string;
294
302
  }) => {
303
+ abortRef.current?.abort();
304
+ abortRef.current = new AbortController();
305
+
295
306
  let sortBy = 'created desc';
296
307
  if (sorting.length > 0) {
297
308
  const sortType = sorting[0].desc ? 'desc' : 'asc';
@@ -308,7 +319,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
308
319
  page_size: data.pagination.pageSize,
309
320
  sorting: sortBy,
310
321
  search,
311
- });
322
+ },
323
+ {
324
+ signal: abortRef.current.signal
325
+ }
326
+ );
312
327
  },
313
328
  onSuccess: (res: any) => {
314
329
  if (selectedChat)