From 720327b58fba099afaaa2d5a74a7e9ff52e43ef2 Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Wed, 10 Aug 2022 13:11:10 +0100 Subject: [PATCH 1/9] fixed pouchdb unable to find the view throwing error --- packages/server/src/api/controllers/view/utils.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/view/utils.js b/packages/server/src/api/controllers/view/utils.js index 5bddbf345c..1fa7a999c4 100644 --- a/packages/server/src/api/controllers/view/utils.js +++ b/packages/server/src/api/controllers/view/utils.js @@ -20,8 +20,13 @@ exports.getView = async viewName => { return null } - const viewDoc = await db.get(generateMemoryViewID(viewName)) - return viewDoc.view + try { + const viewDoc = await db.get(generateMemoryViewID(viewName)) + return viewDoc.view + } catch (err) { + // if PouchDB doesn't found the view it will fall here + return null + } } } From 94081378266c9ac193ebf52f2498063553da1f4f Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Thu, 11 Aug 2022 14:56:13 +0100 Subject: [PATCH 2/9] the error thrown by pouchdb is propagated if it is other than not-found --- packages/server/src/api/controllers/view/utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/view/utils.js b/packages/server/src/api/controllers/view/utils.js index 1fa7a999c4..7b5bad46b4 100644 --- a/packages/server/src/api/controllers/view/utils.js +++ b/packages/server/src/api/controllers/view/utils.js @@ -24,8 +24,10 @@ exports.getView = async viewName => { const viewDoc = await db.get(generateMemoryViewID(viewName)) return viewDoc.view } catch (err) { - // if PouchDB doesn't found the view it will fall here - return null + // Return null when PouchDB doesn't found the view + if (err.status === 404) return null + + throw err } } } From 9ec850842bab3d0f936ac086b63ddf4dc888310c Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Fri, 12 Aug 2022 11:42:18 +0100 Subject: [PATCH 3/9] fix filter not showing --- packages/builder/src/pages/builder/portal/apps/index.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index a089664d2e..13d23f6a51 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -20,7 +20,7 @@ import { store, automationStore } from "builderStore" import { API } from "api" import { onMount } from "svelte" - import { apps, auth, admin, templates, groups } from "stores/portal" + import { apps, auth, admin, templates } from "stores/portal" import download from "downloadjs" import { goto } from "@roxi/routify" import AppRow from "components/start/AppRow.svelte" @@ -355,7 +355,7 @@ {/if}
- {#if $auth.groupsEnabled && $groups.length} + {#if $auth.groupsEnabled} {/if}