Closed albanlorillard closed 4 years ago
@ndelangen guessing this is composition-related?
@albanlorillard was the storybook upgrade the only change you made? also, you can remove the @types/storybook__
dependencies -- we support typescript types natively now.
Hello @shilman Thanks for your quick answer and for tips. ;) Yes, If I downgrade to the last V5 stable version, no problem occurred on runtime after a build nor on live build version.
@kroeder any ideas what might be causing this?
I have a very similar issue and it took me forever to debug but it's a simple problem:
@albanlorillard - I notice in your screenshot above you are navigating to: .../.storybook-static/index.html?path=/story/*
. Are you able to navigate to .../.storybook-static/?path=/story/*
(without the index.html
in the path)? I think it should work if you do.
The SET_STORIES
event handler, getSourceType
will incorrectly return 'external'
which looks for a ref.id
when ref === undefined
.
The bug is in this line of the getSourceType
function. To determine if source
is 'external'
or 'local
', it checks if '.../.storybook-static/index.htmliframe.html' === '.../.storybook-static/iframe.html'
. This check fails when the index.html
is in the path and incorrectly returns 'external'
.
As mentioned earlier, the super easy workaround is to not include index.html
in your browser path.
Unfortunately for me, I'm rendering this within an internal platform tool and I can't get rid of the /index.html
in the path — @shilman @ndelangen , would you take a PR that strips index.html
from the pathname in the getSourceType
comparison?
This fixes the issue for me and would be the gist of the PR:
if (
source === origin ||
source === `${origin + pathname}iframe.html` ||
source === `${origin + pathname.replace(/(?!.*\/).*\.html$/, '')}iframe.html`
) {
return 'local'
}
I don't think this is necessary anymore but I can leave it incase something else breaks:
source === `${origin + pathname}iframe.html`
sidenote: It's not just angular btw, this happens with my react app too if I am at /path/index.html
:
TypeError: Cannot read property 'id' of undefined
at Object.<anonymous> (vendors~main.3dad7906a642bfbf030a.bundle.js:81)
at vendors~main.3dad7906a642bfbf030a.bundle.js:1
at Array.forEach (<anonymous>)
at t.value (vendors~main.3dad7906a642bfbf030a.bundle.js:1)
at e.<anonymous> (vendors~main.3dad7906a642bfbf030a.bundle.js:1)
at e.handler (vendors~main.3dad7906a642bfbf030a.bundle.js:130)
at e.value (vendors~main.3dad7906a642bfbf030a.bundle.js:130)
Even if this doesn't fix the issue mentioned by @albanlorillard , I would still like to get a CR merged with my suggested fix (or something similar) to fix my issue.
@goldhand yes, sounds great!
Thank you for your investigation!
Looking forward to your PR!
No problem, @ndelangen - I just submitted https://github.com/storybookjs/storybook/pull/10421
Whoopee!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.34 containing PR #10421 that references this issue. Upgrade today to try it out!
You can find this prerelease on the @next
NPM tag.
Describe the bug Hello, Since I upgrade Storybook to the version 6 (alpha 29 then alpha 30) on my Angular 9.1 project, my static Storybook not work after build-storybook command. This error appear on the browser console :
But, on live compilation, that work perfectly with
start-storybook
command.To Reproduce Steps to reproduce the behavior:
git clone https://github.com/albanlorillard/bugreport-storybook6-angular9
orgit clone git@github.com:albanlorillard/bugreport-storybook6-angular9.git
This project is a scratch project create with angular-cli 6.1 and the commandng new
.npm install
npm run storybook:build
and launch index.html with your favorite http server.npm run storybook
and open localhost:9001 on your favorite browser.Expected behavior build-storybook should build project without probleme and "Hello world" story should be available.
Screenshots
Code snippets If applicable, add code samples to help explain your problem.
System: Environment Info:
Additional context
Thanks :)