-
Notifications
You must be signed in to change notification settings - Fork 59
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: handle null LiteralMap in RemoteLiteralMapViewer #117
Conversation
@@ -38,7 +38,7 @@ export const RemoteLiteralMapViewer: React.FC<{ | |||
); | |||
} | |||
|
|||
if (map !== undefined) { | |||
if (map !== undefined && map !== null) { |
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 you're handling both cases, a coercing equality against null
will do it and is a common pattern in this repository.
if (map != null) { ... }
Generally when checking protobuf fields which are not primitive values, I use this form of check.
@kanterov
The generated code to debug protobuf messages uses prototype inheritance to handle values which are absent in the protobuf message. It follows specific conventions for each data type, some of which cause problems if they aren't handled correctly. I've debated potentially writing a transform layer that makes the models a little more reliable and less error-prone. |
cc8e66a
to
58f73df
Compare
@kanterov Looks like there is a type issue with one of the storybook stories due to updating |
flyteidl generated JS code uses null as a default value for non-primitive objects.
58f73df
to
4ef0ead
Compare
Codecov Report
@@ Coverage Diff @@
## master #117 +/- ##
=======================================
Coverage 70.60% 70.60%
=======================================
Files 387 387
Lines 6531 6531
Branches 1048 1048
=======================================
Hits 4611 4611
Misses 1920 1920
Continue to review full report at Codecov.
|
@schottra thanks for your help, I fixed it, didn't have enough time yesterday :) |
## [0.17.4](http://github.com/lyft/flyteconsole/compare/v0.17.3...v0.17.4) (2020-11-11) ### Bug Fixes * handle null LiteralMap in RemoteLiteralMapViewer ([#117](http://github.com/lyft/flyteconsole/issues/117)) ([d174b24](http://github.com/lyft/flyteconsole/commit/d174b24db1087d4d23c279a0fd8b8a30af845bf6))
🎉 This PR is included in version 0.17.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
TL;DR
Handle null LiteralMap in RemoteLiteralMapViewer
Type
Are all requirements met?
Complete description
Not sure I completely understand how proto objects translate to JS objects. There are cases when
fullInputs
andfullOutputs
are equal to null. Pull request adds a null check that complements the existing undefined check.