You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've dug deep enough to create a patch to be able to successfully render a story for those who can't wait and need something in the interim. It's definitely not perfect, but it is better than no storybook at all.
diff --git a/dist/client/preview/index.js b/dist/client/preview/index.js
index 38a6be377c58c2efab3fdd446a0272e30045ced9..3accfe7f72096cfce6d2bd63f37fd3005819a231 100644
--- a/dist/client/preview/index.js+++ b/dist/client/preview/index.js@@ -70,18 +70,19 @@ function prepare(rawStory, innerStory) {
});
}
- story = _vue["default"].extend(story); // @ts-ignore // https://github.com/storybookjs/storybook/pull/7578#discussion_r307984824- } else if (story.options[WRAPS]) {+ story = _vue["defineComponent"](story); // @ts-ignore // https://github.com/storybookjs/storybook/pull/7578#discussion_r307984824+ } else if (story[WRAPS]) {
return story;
}
- return _vue["default"].extend((_Vue$extend = {}, _defineProperty(_Vue$extend, WRAPS, story), _defineProperty(_Vue$extend, _render.VALUES, Object.assign(Object.assign({}, innerStory ? innerStory.options[_render.VALUES] : {}), (0, _util.extractProps)(story))), _defineProperty(_Vue$extend, "functional", true), _defineProperty(_Vue$extend, "render", function render(h, _ref) {- var data = _ref.data,- parent = _ref.parent,- children = _ref.children;- return h(story, Object.assign(Object.assign({}, data), {}, {+ return _vue["defineComponent"]((_Vue$extend = {}, _defineProperty(_Vue$extend, WRAPS, story), _defineProperty(_Vue$extend, _render.VALUES, Object.assign(Object.assign({}, innerStory ? innerStory[_render.VALUES] : {}), (0, _util.extractProps)(story))), _defineProperty(_Vue$extend, "functional", true), _defineProperty(_Vue$extend, "render", function render(_ref) {+ var data = _ref.$data,+ props = _ref.$props,+ parent = _ref.$parent,+ children = _ref.$children;+ return _vue['h'](story, Object.assign(Object.assign({}, data), {}, {
// @ts-ignore // https://github.com/storybookjs/storybook/pull/7578#discussion_r307986196
- props: Object.assign(Object.assign({}, data.props || {}), parent.$root[_render.VALUES])+ props: Object.assign(Object.assign({}, props || {}), parent.$root[_render.VALUES])
}), children);
}), _Vue$extend));
}
diff --git a/dist/client/preview/render.js b/dist/client/preview/render.js
index 510391bf8a72e0ae4246176901522654e425b4b0..6b914faad18f7f69af30456d30a08c77fd02eaea 100644
--- a/dist/client/preview/render.js+++ b/dist/client/preview/render.js@@ -44,20 +44,24 @@ var COMPONENT = 'STORYBOOK_COMPONENT';
exports.COMPONENT = COMPONENT;
var VALUES = 'STORYBOOK_VALUES';
exports.VALUES = VALUES;
-var root = new _vue["default"]({- data: function data() {- var _ref;-- return _ref = {}, _defineProperty(_ref, COMPONENT, undefined), _defineProperty(_ref, VALUES, {}), _ref;+var _ref = _vue['markRaw']({+ [COMPONENT]: undefined,+ [VALUES]: {},+});+var root = _vue["createApp"]({+ setup(props, { slots, attrs, emit }) {+ var children = _ref[COMPONENT] ? [_vue['h'](_ref[COMPONENT])] : undefined;++ return () => _vue['h'](+ 'div',+ {+ id: 'root',+ [COMPONENT]: _ref[COMPONENT],+ [VALUES]: _ref[VALUES],+ },+ children+ );
},
- render: function render(h) {- var children = this[COMPONENT] ? [h(this[COMPONENT])] : undefined;- return h('div', {- attrs: {- id: 'root'- }- }, children);- }
});
function render(_ref2) {
@@ -69,7 +73,7 @@ function render(_ref2) {
showError = _ref2.showError,
showException = _ref2.showException,
forceRender = _ref2.forceRender;
- _vue["default"].config.errorHandler = showException; // FIXME: move this into root[COMPONENT] = element+ root.config.errorHandler = showException; // FIXME: move this into root[COMPONENT] = element
// once we get rid of knobs so we don't have to re-create
// a new component each time
@@ -85,14 +89,14 @@ function render(_ref2) {
showMain(); // at component creation || refresh by HMR or switching stories
- if (!root[COMPONENT] || !forceRender) {- root[COMPONENT] = element;+ if (!_ref[COMPONENT] || !forceRender) {+ _ref[COMPONENT] = element;
} // @ts-ignore https://github.com/storybookjs/storrybook/pull/7578#discussion_r307986139
- root[VALUES] = Object.assign(Object.assign({}, element.options[VALUES]), args);+ _ref[VALUES] = Object.assign(Object.assign({}, element[VALUES]), args);
if (!root.$el) {
- root.$mount('#root');+ root.mount('#root');
}
}
\ No newline at end of file
diff --git a/dist/client/preview/util.js b/dist/client/preview/util.js
index ab8c1d3cdb5424fc782e3fb3bee8951ee2d6c7e0..90bbd09f5a6276ea6592c7c0d0a9ba63df83e140 100644
--- a/dist/client/preview/util.js+++ b/dist/client/preview/util.js@@ -79,7 +79,7 @@ function resolveDefault(_ref) {
function extractProps(component) {
// @ts-ignore this options business seems not good according to the types
- return Object.entries(component.options.props || {}).map(function (_ref2) {+ return Object.entries(component.props || {}).map(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
name = _ref3[0],
prop = _ref3[1];
The text was updated successfully, but these errors were encountered:
Describe the bug
Piggybacking off the issue in storybookjs/vue-cli-plugin-storybook#111, This package appears to be completely incompatible with vue 3.
To Reproduce
vue add storybook
yarn version set berry
yarn install
Expected behavior
I expect that using a vue-3 based project, storybook can still render stories without error.
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
.yarnrc.yml
./patches/vue-cli-plugin-storybook.patch
package.json
System
Additional context
I've dug deep enough to create a patch to be able to successfully render a story for those who can't wait and need something in the interim. It's definitely not perfect, but it is better than no storybook at all.
The text was updated successfully, but these errors were encountered: