Skip to content

Commit

Permalink
Addon-contexts: Fix 'cannot read property h of undefined' in pr… (#9001)
Browse files Browse the repository at this point in the history
Addon-contexts: Fix 'cannot read property h of undefined' in preact
  • Loading branch information
shilman authored Nov 29, 2019
2 parents 47868b0 + dc42be5 commit a3b5d42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions addons/contexts/src/preview/frameworks/preact.ts
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);

0 comments on commit a3b5d42

Please sign in to comment.