-
Notifications
You must be signed in to change notification settings - Fork 0
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
Render a module from the database #426
Conversation
This is a placeholder, pending a discussion around how to display and log errors.
NB this is an internal error condition which should never actually occur.
} | ||
// This hook is *technically* conditional. | ||
// But if the condition above fails, then the app is broken anyway. | ||
// eslint-disable-next-line react-hooks/rules-of-hooks |
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.
Bit annoying. Not sure there's a better way.
|
||
export const Error = (p: ErrorProps): JSX.Element => ( | ||
<p className="mx-4">Error: {p.string}</p> | ||
); |
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 need to think about error handling (hackworthltd/primer#237). Until then, at least if we consistently use this component, we've got a single source of information to keep track of what needs cleaning up on the frontend.
if (editableModules.length > 1) { | ||
return ( | ||
<Error | ||
string={"Multiple editable modules: " + JSON.stringify(editableModules)} |
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.
Maybe we should just log a warning here, rather than erroring.
Longer term, we need to think about a frontend equivalent of hackworthltd/primer#179.
packages/primer-app/src/App.tsx
Outdated
return ( | ||
<Error | ||
string={ | ||
"Multiple editable modules: " + JSON.stringify(editableModules) |
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.
It's probably a good idea to mention in the commit message that we don't handle multiple editable modules yet.
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.
If it's not too late (I know that editing commit messages is a pain), maybe also mention that we don't yet render types, only terms.
Thanks. I have one request above, and then (per discussion in chat) we should document the issues with |
This replaces the previous hardcoded trees. Note that we don't yet display a definition's name or type. These will be added in due course, once we've made some design decisions about how to lay out multiple trees. We also currently require that the session contains precisely one editable module, throwing errors otherwise. We will some day relax this decision, once UX issues have been worked out.
With the previous style, further indentation was needed for each new check. Instead, we now utilise early returns to keep a flatter tree.
76430c1
to
cdbcb4a
Compare
This work has revealed that |
No description provided.