app_store ui: do not persist local UI store, hotfix launch button

This commit is contained in:
bitful-pannul 2024-09-19 18:25:40 +03:00
parent a9e858761e
commit 28567b891b

View File

@ -45,9 +45,7 @@ interface AppsStore {
}
const useAppsStore = create<AppsStore>()(
persist(
(set, get): AppsStore => ({
const useAppsStore = create<AppsStore>()((set, get) => ({
listings: {},
installed: {},
downloads: {},
@ -220,6 +218,13 @@ const useAppsStore = create<AppsStore>()(
});
if (res.status === HTTP_STATUS.CREATED) {
await get().fetchInstalled();
// hacky: a small delay (500ms) before fetching homepage apps
// to give the app time to add itself to the homepage
// might make sense to add more state and do retry logic instead.
await new Promise(resolve => setTimeout(resolve, 500));
await get().fetchHomepageApps();
}
} catch (error) {
console.error("Error installing app:", error);
@ -395,11 +400,6 @@ const useAppsStore = create<AppsStore>()(
console.error('WebSocket error:', error);
},
}),
}),
{
name: 'app_store',
}
)
)
}))
export default useAppsStore