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

Render a module from the database #426

Merged
merged 5 commits into from
Jul 14, 2022
Merged

Conversation

georgefst
Copy link
Contributor

No description provided.

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
Copy link
Contributor Author

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>
);
Copy link
Contributor Author

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)}
Copy link
Contributor Author

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.

@georgefst georgefst requested a review from a team July 14, 2022 11:32
return (
<Error
string={
"Multiple editable modules: " + JSON.stringify(editableModules)
Copy link
Member

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.

Copy link
Member

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.

@dhess
Copy link
Member

dhess commented Jul 14, 2022

Thanks. I have one request above, and then (per discussion in chat) we should document the issues with viewTreeExpr and viewTreeType in a comment in this PR, for posterity.

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.
@georgefst georgefst force-pushed the georgefst/non-hardcoded-session-tree branch from 76430c1 to cdbcb4a Compare July 14, 2022 14:50
@georgefst
Copy link
Contributor Author

This work has revealed that viewTreeExpr (and viewTreeType), introduced in hackworthltd/primer#180, produce highly unintuitive output. I'd guess they're not quite doing what @brprice intended, in that information about children is shown in fork nodes. But we're approaching the point where we'll want to replace this placeholder implementation anyway.

Screen Shot 2022-07-14 at 8 41 43 AM

@georgefst georgefst added the Ready to merge Ready to merge label Jul 14, 2022
mergify bot added a commit that referenced this pull request Jul 14, 2022
@mergify mergify bot merged commit 410f96e into main Jul 14, 2022
@mergify mergify bot deleted the georgefst/non-hardcoded-session-tree branch July 14, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready to merge Ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants