improvement: notification feature polished. feature tabs following the same notification socket emmited data to be updated.

This commit is contained in:
2026-07-18 16:57:13 +03:30
parent 9f6ec193d2
commit 9941dca849
23 changed files with 506 additions and 63 deletions

View File

@@ -107,21 +107,36 @@ export function OrganizationsPage() {
const existingRows = items;
async function loadList() {
setLoading(true);
toast.setError('');
async function loadList(options?: { silent?: boolean }) {
const silent = options?.silent ?? false;
if (!silent) {
setLoading(true);
toast.setError('');
}
try {
const res = await organizationApi.list();
setItems(res.data.items);
} catch (e) {
toast.showError(formatApiMessage(e));
if (!silent) {
toast.showError(formatApiMessage(e));
}
} finally {
setLoading(false);
if (!silent) setLoading(false);
}
}
useEffect(() => {
void loadList();
// eslint-disable-next-line react-hooks/exhaustive-deps -- mount-only
}, []);
useEffect(() => {
const onChanged = () => {
void loadList({ silent: true });
};
window.addEventListener('pending-connections-changed', onChanged);
return () => window.removeEventListener('pending-connections-changed', onChanged);
// eslint-disable-next-line react-hooks/exhaustive-deps -- soft refresh from live inbox
}, []);
useEffect(() => {