-
Notifications
You must be signed in to change notification settings - Fork 6
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 webapp crash when no pipeline #333
Conversation
This inappropriate `!` was letting a `null` in, which was crashing `PipelineSelect`.
<PipelineSelect | ||
selectedPipeline={pipeline.pipelineIndex} | ||
onChange={setPipeline} | ||
pipelines={config.pipelines!} |
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.
This inappropriate !
was letting a null
in, which was crashing PipelineSelect
.
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.
This looks good to me. Just want to confirm that this is the desired behaviour:
No pipelines -> don't render the selector
rather than
No pipelines -> render empty selector.
webapp/src/components/PageHeader.tsx
Outdated
<PipelineSelect | ||
selectedPipeline={pipeline.pipelineIndex} | ||
onChange={setPipeline} | ||
pipelines={config.pipelines!} | ||
pipelines={config.pipelines} |
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.
This looks good to me. Just want to confirm that this is the desired behaviour:
No pipelines -> don't render the selector
rather than
No pipelines -> render empty selector.
Good question @christyler3030. 👍 I wanted to do the quickest fix possible so JavaScript stops crashing and it was midnight so I didn't think too much. Let's take the time now, it's not so much of a rush.
I like your alternative suggestion. In fact, that's how it used to work before the bug was introduced here, so I'll revert to that. It has two (other) benefits:
- The place for the select menu is taken while the config loads, as opposed to popping and moving the project name once it loads.
- This implementation supports
pipelines
being[]
the same as when it isnull
.
pipelines={config.pipelines} | |
pipelines={config?.pipelines ?? []} |
On that topic, note that the back end currently crashes with an unclear error message when you configure "pipeline": []
. I created an issue to look into this: #335
instead of not rendering the select menu.
Resolve #331
Description:
Checklist:
You should check all boxes before the PR is ready. If a box does not apply, check it to acknowledge it.
ran
pre-commit run --all-files
at the end.our users.
README
files and our wiki for any big design decisions, if relevant.