-
Notifications
You must be signed in to change notification settings - Fork 35
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
Subject field #2158
Subject field #2158
Conversation
subject: allSubjects.map(({qcode, name, parent}) => { | ||
var itemToStore: IStorageFormat = {qcode, name, parent}; | ||
|
||
if (parent != 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.
When would this condition make a difference?
const a = {x: 1}
const b = {...a}
if (b.x != null) { // <-- would never make a difference because if a.x and b.x are the same
b.x = a.x;
}
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.
Doesn't, I had it copied over from the subject in client-core
|
||
return itemToStore; | ||
}), | ||
subject: allSubjects, |
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.
allSubjects
is confusing naming, because if you filter it, you can't call it "all" anymore
@@ -36,12 +36,12 @@ export function getSubjectField(): IFieldDefinition { | |||
return (item.subject ?? []).map(({qcode}) => qcode); | |||
}, | |||
storeValue: (item, operationalValue: Array<ISubjectCode['qcode']>) => { | |||
const allSubjects: Array<ISubjectCode> = (planningApi.redux.store.getState().subjects ?? []) | |||
const filteredSubjects: Array<ISubjectCode> = (planningApi.redux.store.getState().subjects ?? []) |
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.
filteredSubjects
isn't much better. It doesn't make sense to mention programming operations (filter,map,reduce etc.) that you performed - but what is being achieved by those programming operations. When it's something small and obvious like here I'd call it subjects
simply without elaborating. If you wanted more details, then maybe subjectsFull
since the purpose of the operation is to return full objects instead of qcodes only.
680c4ae
into
superdesk:authoring-react-planning
STT-63
Front-end checklist
memo
orPureComponent
to define new React components (and updates existing usages in modified code segments)lodash.get
with optional chaining and nullish coalescing for modified code segmentssuperdeskApi
)superdesk-ui-framework
andsuperdeskApi
when possible instead of using ones defined in this repository.planningApi
where it is possible to usesuperdeskApi
planningApi
)