Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadComponents null #34

Closed
antonybudianto opened this issue Feb 3, 2018 · 7 comments
Closed

loadComponents null #34

antonybudianto opened this issue Feb 3, 2018 · 7 comments

Comments

@antonybudianto
Copy link

antonybudianto commented Feb 3, 2018

Hi, I just upgraded to 1.0.0

and I got the following error:

Uncaught TypeError: Cannot read property 'then' of null
    at Object../src/index.js (index.js:13)
    at __webpack_require__ (bootstrap 9fe4b7230cd8077e37a9:707)
    at fn (bootstrap 9fe4b7230cd8077e37a9:112)
    at Object.0 (registerServiceWorker.js:117)
    at __webpack_require__ (bootstrap 9fe4b7230cd8077e37a9:707)
    at ./node_modules/@firebase/app/dist/esm/index.js.Object.defineProperty.value (bootstrap 9fe4b7230cd8077e37a9:805)
    at bundle.js:809

The offending line:

loadComponents().then(() => {

Please help, thank you

@kikoanis
Copy link

kikoanis commented Feb 3, 2018

Having the same issue. I am guessing the tree traverse was not a success on server side. However, there was a change in the code that makes this fail ungracefully.
I think this line
if (!rootState.children) return null should not just return null but a promise.

I believe this is due to a change in this line

I am not entirely sure but i think that line changed from

var ids = window[_constants.COMPONENT_IDS] || [];
to
const state = window[LOADABLE_STATE]

notice the fallback here as []

@gregberge
Copy link
Owner

There is a problem in the promise, this is why you are getting that error. I will fix it.

@kikoanis
Copy link

kikoanis commented Feb 3, 2018

Thank you for the quick fix. much appreciated.

@gregberge
Copy link
Owner

Anyway if you got this error, you should have a SSR issue. Do you have a __LOADABLE_STATE__ in your HTML code?

@kikoanis
Copy link

kikoanis commented Feb 3, 2018

I do, but it always returns an empty array. I think because I use react-router and error boundary component. It seems that I can't get the tree traverse working correctly. Will do more digging and see if I notice anything in your code. Thanks again.

@kikoanis
Copy link

kikoanis commented Feb 3, 2018

Not sure if this change was necessary
if (!state || !state.children)

You may not have a component that needs to be lazy loaded

@antonybudianto
Copy link
Author

antonybudianto commented Feb 4, 2018

I've __LOADABLE_STATE__ on the html, but still error

@neoziro , I think this line didn't check for empty object, the state is {} from my debug result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants