-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix: correctly await types in serve #1242
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you for fixing this :). LGTM I have only a small question.
}, [info]); | ||
|
||
useEffect(() => { | ||
if (waiting) return; | ||
if (waiting || !initialized) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add initialized
to dependency list of the useEffect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do yes, good catch
if (info.types) { | ||
const proms = info.types.map((t) => { | ||
return getModule(t.name, t.url).then((mo) => { | ||
window[t.name] = mo; | ||
}); | ||
}); | ||
return Promise.all(proms); | ||
} | ||
return Promise.resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional]
alternative you could set window[t.name] to a promise
window[t.name] = getModule(t.name, t.url);
then you would not need to wait here
and I think that would be closer to how it work in a real mashup
Motivation
Fixes so that serve awaits added types before running.
Requirements checklist
yarn spec
When build and tests have passed: