mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: prevent stale values in edit user form after save (#25859)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
import { goto, invalidateAll } from '$app/navigation';
|
||||||
import AdminCard from '$lib/components/AdminCard.svelte';
|
import AdminCard from '$lib/components/AdminCard.svelte';
|
||||||
import AdminPageLayout from '$lib/components/layouts/AdminPageLayout.svelte';
|
import AdminPageLayout from '$lib/components/layouts/AdminPageLayout.svelte';
|
||||||
import OnEvents from '$lib/components/OnEvents.svelte';
|
import OnEvents from '$lib/components/OnEvents.svelte';
|
||||||
@@ -48,10 +48,7 @@
|
|||||||
|
|
||||||
const { children, data }: Props = $props();
|
const { children, data }: Props = $props();
|
||||||
|
|
||||||
let user = $state(data.user);
|
const { user, userPreferences, userStatistics, userSessions } = $derived(data);
|
||||||
const userPreferences = $state(data.userPreferences);
|
|
||||||
const userStatistics = $state(data.userStatistics);
|
|
||||||
const userSessions = $state(data.userSessions);
|
|
||||||
const TiB = 1024 ** 4;
|
const TiB = 1024 ** 4;
|
||||||
const usage = $derived(user.quotaUsageInBytes ?? 0);
|
const usage = $derived(user.quotaUsageInBytes ?? 0);
|
||||||
let [statsUsage, statsUsageUnit] = $derived(getBytesWithUnit(usage, usage > TiB ? 2 : 0));
|
let [statsUsage, statsUsageUnit] = $derived(getBytesWithUnit(usage, usage > TiB ? 2 : 0));
|
||||||
@@ -79,9 +76,10 @@
|
|||||||
|
|
||||||
const { ResetPassword, ResetPinCode, Update, Delete, Restore } = $derived(getUserAdminActions($t, user));
|
const { ResetPassword, ResetPinCode, Update, Delete, Restore } = $derived(getUserAdminActions($t, user));
|
||||||
|
|
||||||
const onUpdate = (update: UserAdminResponseDto) => {
|
const onUpdate = async (update: UserAdminResponseDto) => {
|
||||||
if (update.id === user.id) {
|
if (update.id === user.id) {
|
||||||
user = update;
|
data.user = update;
|
||||||
|
await invalidateAll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,10 @@
|
|||||||
|
|
||||||
let { data }: Props = $props();
|
let { data }: Props = $props();
|
||||||
|
|
||||||
const user = $state(data.user);
|
const user = $derived(data.user);
|
||||||
let isAdmin = $state(user.isAdmin);
|
let { isAdmin, name, email } = $derived(user);
|
||||||
let name = $state(user.name);
|
let storageLabel = $derived(user.storageLabel || '');
|
||||||
let email = $state(user.email);
|
const previousQuota = $derived(user.quotaSizeInBytes);
|
||||||
let storageLabel = $state(user.storageLabel || '');
|
|
||||||
const previousQuota = $state(user.quotaSizeInBytes);
|
|
||||||
|
|
||||||
let quotaSize = $derived(
|
let quotaSize = $derived(
|
||||||
typeof user.quotaSizeInBytes === 'number' ? convertFromBytes(user.quotaSizeInBytes, ByteUnit.GiB) : undefined,
|
typeof user.quotaSizeInBytes === 'number' ? convertFromBytes(user.quotaSizeInBytes, ByteUnit.GiB) : undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user