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

Fix webapp crash when no pipeline #333

Merged
merged 2 commits into from
Dec 8, 2022
Merged

Conversation

JosephMarinier
Copy link
Contributor

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.

  • ISSUE NUMBER. You linked the issue number (Ex: Resolve #XXX).
  • PRE-COMMIT. You ran pre-commit on all commits, or else, you
    ran pre-commit run --all-files at the end.
  • USER CHANGES. The changes are added to CHANGELOG.md and the documentation, if they impact
    our users.
  • DEV CHANGES.
    • Update the documentation if this PR changes how to develop/launch on the app.
    • Update the README files and our wiki for any big design decisions, if relevant.
    • Add unit tests, docstrings, typing and comments for complex sections.

This inappropriate `!` was letting a `null` in, which was crashing `PipelineSelect`.
<PipelineSelect
selectedPipeline={pipeline.pipelineIndex}
onChange={setPipeline}
pipelines={config.pipelines!}
Copy link
Contributor Author

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.

Copy link
Collaborator

@christyler3030 christyler3030 left a 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.

<PipelineSelect
selectedPipeline={pipeline.pipelineIndex}
onChange={setPipeline}
pipelines={config.pipelines!}
pipelines={config.pipelines}
Copy link
Contributor Author

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:

  1. The place for the select menu is taken while the config loads, as opposed to popping and moving the project name once it loads.
  2. This implementation supports pipelines being [] the same as when it is null.
Suggested change
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.
@JosephMarinier JosephMarinier enabled auto-merge (squash) December 8, 2022 16:17
@JosephMarinier JosephMarinier merged commit fc659ac into main Dec 8, 2022
@JosephMarinier JosephMarinier deleted the joseph/fix-no-pipeline branch December 8, 2022 16:30
JosephMarinier added a commit that referenced this pull request Dec 20, 2022
@JosephMarinier JosephMarinier added the bug Something isn't working label Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web app no longer loading when there is no pipeline
2 participants