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>
This commit is contained in:
Braks
2021-11-19 13:55:42 +01:00
parent 9c0e293d82
commit 3f139dffee
2 changed files with 2 additions and 2 deletions

View File

@@ -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

View File

@@ -5,7 +5,7 @@ import { onLoadToObject } from '~/utils'
let id = 0
export default (options?: Partial<FlowOptions>) => {
let store = inject(Store)!
let store = inject(Store, null)!
if (!store) {
const withStorage = options?.storageKey ?? false