Render stories with context in mithril

This commit is contained in:
Tom Coleman 2018-04-13 20:09:28 +10:00
parent c2fa6c33d7
commit 3cb0823caa

View File

@ -44,7 +44,7 @@ export function renderMain(data, storyStore, forceRender) {
const noPreview = <NoPreview />;
const { selectedKind, selectedStory } = data;
const story = storyStore.getStory(selectedKind, selectedStory);
const story = storyStore.getStoryWithContext(selectedKind, selectedStory);
if (!story) {
m.mount(rootEl, { view: () => noPreview });
return;
@ -57,12 +57,7 @@ export function renderMain(data, storyStore, forceRender) {
previousKind = selectedKind;
previousStory = selectedStory;
const context = {
kind: selectedKind,
story: selectedStory,
};
const element = story(context);
const element = story();
if (!element) {
const error = {