-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
Deploy preview for catwalk-qlikcore ready! Built with commit 087d0d2 |
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.
👌 Just a few ideas, but LGTM to me
src/components/selection-field.jsx
Outdated
const model = useModel(app, createDefinition(field)); | ||
const layout = useLayout(model); | ||
const [model, modelError] = useModel(app, createDefinition(field)); | ||
if (modelError) { |
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.
Stylewise, I would've gone with a one-liner on these to keep the logic a bit more condensed so it's easier to read if (modelError) throw modelError;
Just an idea: What about having a error-throwing hook for all of these?
Like:
const [model] = useErrorThrow(useModel(app, createDefinition(field));`
You mean sth like my last commit @peol? :) |
Yes, that looks great 👍 Perhaps the naming could be better though, feel free to rename from my suggestion, it sounds a little weird now that I see it. Essentially what it does is giving you the result (resolved value) from a promise, so maybe |
Hm, true. The throw error-thingie is just a nice side effect.. |
Fixes #217