-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addon-contexts: Fix 'cannot read property h of undefined' in pr… (#9001)
Addon-contexts: Fix 'cannot read property h of undefined' in preact
- Loading branch information
Showing
1 changed file
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import Preact from 'preact'; | ||
import { h, VNode } from 'preact'; | ||
import { createAddonDecorator, Render } from '../../index'; | ||
import { ContextsPreviewAPI } from '../ContextsPreviewAPI'; | ||
|
||
/** | ||
* This is the framework specific bindings for Preact. | ||
* '@storybook/preact' expects the returning object from a decorator to be a 'Preact vNode'. | ||
*/ | ||
export const renderPreact: Render<Preact.VNode> = (contextNodes, propsMap, getStoryVNode) => { | ||
export const renderPreact: Render<VNode> = (contextNodes, propsMap, getStoryVNode) => { | ||
const { getRendererFrom } = ContextsPreviewAPI(); | ||
return getRendererFrom(Preact.h)(contextNodes, propsMap, getStoryVNode); | ||
return getRendererFrom(h)(contextNodes, propsMap, getStoryVNode); | ||
}; | ||
|
||
export const withContexts = createAddonDecorator(renderPreact); |