-
Notifications
You must be signed in to change notification settings - Fork 670
Firehose: honor optional prop for watches on individual resources
#1711
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -25,8 +25,12 @@ const processReduxId = ({k8s}, props) => { | |||
| } | ||||
|
|
||||
| if (!isList) { | ||||
| const stuff = k8s.get(reduxID); | ||||
| return stuff ? stuff.toJS() : {}; | ||||
| let stuff = k8s.get(reduxID); | ||||
| if (stuff) { | ||||
| stuff = stuff.toJS(); | ||||
| stuff.optional = props.optional; | ||||
| } | ||||
| return stuff || {}; | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we use the same approach which is used for lists? const data = k8s.getIn([reduxID, 'data']);
return {
data: data && data.toJS(),
loadError: k8s.getIn([reduxID, 'loadError']),
loaded: k8s.getIn([reduxID, 'loaded']),
optional: props.optional,
ignoreIfMissing: props.ignoreIfMissing,
};This way we can optionally swap the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually the console/frontend/public/reducers/k8s.ts Line 135 in 98211bb
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know, but it will be easier to extend for adding a support of raw immutables
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. meaning that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is needed, I propose to do it in a follow-up. |
||||
| } | ||||
|
|
||||
| const data = k8s.getIn([reduxID, 'data']); | ||||
|
|
@@ -208,6 +212,6 @@ Firehose.propTypes = { | |||
| selector: PropTypes.object, | ||||
| fieldSelector: PropTypes.string, | ||||
| isList: PropTypes.bool, | ||||
| optional: PropTypes.bool, | ||||
| optional: PropTypes.bool, // do not block children-rendering while resource is still being loaded; do not fail if resource is missing (404) | ||||
| })).isRequired, | ||||
| }; | ||||
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.
Ah, OK. I see now. We didn't have proper support for
optionalwith individual resources, only lists.