diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index ce31bd84aa..095bf2023b 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -18,7 +18,7 @@ auth, groups, licensing, - enriched as enrichedApps, + enrichedApps, } from "stores/portal" import { goto } from "@roxi/routify" import { AppStatus } from "constants" diff --git a/packages/builder/src/pages/builder/portal/apps/FavouriteAppButton.svelte b/packages/builder/src/pages/builder/portal/apps/FavouriteAppButton.svelte index c5e29cc3f6..7d6b4d81a9 100644 --- a/packages/builder/src/pages/builder/portal/apps/FavouriteAppButton.svelte +++ b/packages/builder/src/pages/builder/portal/apps/FavouriteAppButton.svelte @@ -21,8 +21,22 @@ {size} on:click={async e => { e.stopPropagation() + const userAppFavourites = new Set([...($auth.user.appFavourites || [])]) + let processedAppIds = [] + + if ($auth.user.appFavourites && app?.appId) { + if (userAppFavourites.has(app.appId)) { + userAppFavourites.delete(app.appId) + } else { + userAppFavourites.add(app.appId) + } + processedAppIds = [...userAppFavourites] + } else { + processedAppIds = [app.appId] + } + await auth.updateSelf({ - appFavourites: [app?.appId], + appFavourites: processedAppIds, }) }} disabled={!app} diff --git a/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte b/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte index 13ba564e0b..3f8e9e7545 100644 --- a/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/[appId]/index.svelte @@ -1,10 +1,6 @@