A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
common: fix too many queries to db
Ammar Ahmedea1ffc59b88d
diff --git a/packages/common/src/hooks/use-is-feature-available.ts b/packages/common/src/hooks/use-is-feature-available.tsindex d00b65598..67f20588e 100644--- a/packages/common/src/hooks/use-is-feature-available.ts+++ b/packages/common/src/hooks/use-is-feature-available.ts@@ -32,7 +32,7 @@ export function useIsFeatureAvailable<TId extends FeatureId>() {const result = usePromise(() => (id ? isFeatureAvailable(id, value) : undefined),- [id, value]+ []);return result.status === "fulfilled" ? result.value : undefined;}@@ -46,7 +46,7 @@ export function useAreFeaturesAvailable<TIds extends FeatureId[]>(useEffect(() => {areFeaturesAvailable(ids, values).then((result) => setResult(result));- }, [ids, values]);+ }, []);return result;}diff --git a/packages/common/src/utils/is-feature-available.ts b/packages/common/src/utils/is-feature-available.tsindex 3af789cca..897e1aebf 100644--- a/packages/common/src/utils/is-feature-available.ts+++ b/packages/common/src/utils/is-feature-available.ts@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { database as db } from "../database.js";import { SubscriptionPlan, SubscriptionType } from "@notesnook/core";+import { database as db } from "../database.js";type CaptionValue = ("infinity" | (string & {})) | boolean | number;type Limit<TCaption extends CaptionValue = CaptionValue> = {@@ -533,7 +533,7 @@ export function getFeaturesTable() {return rows;}-type FeatureUsage = {+export type FeatureUsage = {id: FeatureId;total: number;used: number;