From 3f139dffee7c0e50624949cd91eda53b520ce01e Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 19 Nov 2021 13:55:42 +0100 Subject: [PATCH] update: add default null value to injections * "disables" warnings about injection not being found * we assume that the injection can be undefined, so we don't need to be spammed about missing injections Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- src/composables/useHooks.ts | 2 +- src/composables/useStore.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/composables/useHooks.ts b/src/composables/useHooks.ts index b1cec8d2..b9e49b07 100644 --- a/src/composables/useHooks.ts +++ b/src/composables/useHooks.ts @@ -67,7 +67,7 @@ const bind = (emit: EmitFunc, hooks: FlowHooks) => { } export default (store: FlowStore, emit?: EmitFunc) => { - let hooks = inject(Hooks)! + let hooks = inject(Hooks, null)! if (!hooks) { if (import.meta.env.DEV) console.warn('hooks context not found; creating default hooks') hooks = store.hooks diff --git a/src/composables/useStore.ts b/src/composables/useStore.ts index b318c42f..8c484660 100644 --- a/src/composables/useStore.ts +++ b/src/composables/useStore.ts @@ -5,7 +5,7 @@ import { onLoadToObject } from '~/utils' let id = 0 export default (options?: Partial) => { - let store = inject(Store)! + let store = inject(Store, null)! if (!store) { const withStorage = options?.storageKey ?? false