diff --git a/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs b/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs index 13664c07e..1c1a825d2 100644 --- a/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs +++ b/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs @@ -131,22 +131,22 @@ public class RustCoreService : IAsyncDisposable /// Get the list of table names that need to be synced. /// /// Array of table names. + /// Thrown if WASM module is unavailable. public async Task GetSyncableTableNamesAsync() { - if (!await IsAvailableAsync()) + // Wait for WASM to be available with retries, as it may still be loading. + if (!await WaitForAvailabilityAsync()) { - return SyncableTables.Names; + throw new InvalidOperationException("Rust WASM module is not available."); } - try + var result = await jsRuntime.InvokeAsync("rustCoreGetSyncableTableNames"); + if (result == null || result.Length == 0) { - var result = await jsRuntime.InvokeAsync("rustCoreGetSyncableTableNames"); - return result ?? SyncableTables.Names; - } - catch - { - return SyncableTables.Names; + throw new InvalidOperationException("Failed to get syncable table names from Rust WASM."); } + + return result; } /// diff --git a/apps/server/AliasVault.Client/Services/JsInterop/RustCore/SyncableTables.cs b/apps/server/AliasVault.Client/Services/JsInterop/RustCore/SyncableTables.cs deleted file mode 100644 index 7156405db..000000000 --- a/apps/server/AliasVault.Client/Services/JsInterop/RustCore/SyncableTables.cs +++ /dev/null @@ -1,32 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) aliasvault. All rights reserved. -// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information. -// -//----------------------------------------------------------------------- - -namespace AliasVault.Client.Services.JsInterop.RustCore; - -/// -/// List of syncable table names that need to be read for merge operations. -/// -public static class SyncableTables -{ - /// - /// Table names that need LWW merge. - /// - public static readonly string[] Names = - [ - "Items", - "FieldValues", - "Folders", - "Tags", - "ItemTags", - "Attachments", - "TotpCodes", - "Passkeys", - "FieldDefinitions", - "FieldHistories", - "Logos", - ]; -}