From 4a694e752290a8a5f5722bd931b04872d6dc5706 Mon Sep 17 00:00:00 2001 From: Christian Alfoni Date: Tue, 12 Jan 2021 07:36:24 +0100 Subject: [PATCH] fix(overmind-vue): move last piece of logic over --- .../node_modules/overmind-vue/src/index.ts | 16 +--------------- packages/node_modules/overmind-vue/src/vue3.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/node_modules/overmind-vue/src/index.ts b/packages/node_modules/overmind-vue/src/index.ts index d4ad20db..96c68fe2 100644 --- a/packages/node_modules/overmind-vue/src/index.ts +++ b/packages/node_modules/overmind-vue/src/index.ts @@ -5,7 +5,7 @@ import { MODE_SSR, Overmind, } from 'overmind' -import { Component, ComponentOptions, defineComponent, provide, h } from 'vue' +import { Component, ComponentOptions } from 'vue' type AnyComponent = ComponentOptions | Component @@ -177,17 +177,3 @@ export function createConnect( } as any } } - -export const withOvermind = ( - instance: Overmind, - Component: Component -) => { - return defineComponent({ - setup() { - provide('overmind', instance) - }, - render() { - return h(Component) - }, - }) -} diff --git a/packages/node_modules/overmind-vue/src/vue3.ts b/packages/node_modules/overmind-vue/src/vue3.ts index b17cde18..d1abc6bd 100644 --- a/packages/node_modules/overmind-vue/src/vue3.ts +++ b/packages/node_modules/overmind-vue/src/vue3.ts @@ -13,12 +13,30 @@ import { onRenderTracked, onMounted, onBeforeUnmount, + defineComponent, + provide, + h, + Component, } from 'vue' const IS_PRODUCTION = ENVIRONMENT === 'production' let nextComponentId = 0 +export const withOvermind = ( + instance: Overmind, + Component: Component +) => { + return defineComponent({ + setup() { + provide('overmind', instance) + }, + render() { + return h(Component) + }, + }) +} + export interface StateHook { (): Ref['state']> ['state']) => object>(