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

feat: display removed context props in the UI #6844

Merged
merged 14 commits into from
Apr 12, 2024

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Apr 12, 2024

This PR shows context warnings in the UI if they exist.

That means that if you provide invalid properties on the top level, you'll get the result back, but we'll also tell you that we didn't take these properties into account.

Screenie:

image

Copy link

vercel bot commented Apr 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 9:14am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 12, 2024 9:14am

@thomasheartman thomasheartman marked this pull request as draft April 12, 2024 08:03
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

@thomasheartman thomasheartman force-pushed the feat/show-removed-context-props-in-ui branch from cb0703f to 7f7cd71 Compare April 12, 2024 08:42
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

View detailed results in CodeScene

@@ -28,6 +28,46 @@ const StyledAlert = styled(Alert)(({ theme }) => ({
marginBottom: theme.spacing(3),
}));

const GenerateWarningMessages: React.FC<{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 4.33 to 4.40, threshold = 4

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

View detailed results in CodeScene

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

View detailed results in CodeScene

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice, just a few comments/questions but non-blockers

Comment on lines +358 to +360
<GenerateWarningMessages
response={results}
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component will be null when no warning, I'm just wondering if this is ok (i.e. react knows how to handle null components). Even if react supports this, I remember we were using conditional rendering rather than returning null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that react knows how to handle nulls, yeah. I think it's even preferable to, say, a, fragment. ConditionallyRender also returns null if it's not rendering anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And because in this case, the decision whether to render something or not can be a little complex (though I guess condition={results.warnings?.invalidContextProperties?.length > 0} would work), I think it makes sense to relegate it to the function instead.

Does that sound reasonable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable! I kind of like this approach because it requires less boilerplate code (I mean, tags are boilerplate in a way). So I think it's good and something for my TIL list :)

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

View detailed results in CodeScene

@thomasheartman thomasheartman merged commit 6f79688 into main Apr 12, 2024
13 checks passed
@thomasheartman thomasheartman deleted the feat/show-removed-context-props-in-ui branch April 12, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants