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

records: allow to override affiliations display #260

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"semantic-ui-css": "^2.4.0",
"semantic-ui-react": "^2.1.0",
"tinymce": "^6.7.2",
"react-overridable": "^0.0.3",
"yup": "^0.32.11"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import React from "react";
import { Image } from "../../../Image";
import { Header } from "semantic-ui-react";
import Overridable from "react-overridable";

const makeIdEntry = (identifier) => {
let icon, link;
Expand Down Expand Up @@ -85,14 +86,23 @@ export const AffiliationsSuggestions = (creatibutors, isOrganization) => {
text: creatibutor.name,
value: creatibutor.name,
extra: creatibutor,
key: creatibutor.name,
name: creatibutor.name,
key: creatibutor.id,
id: creatibutor.id,
content: (
<Header>
{name} {idString.length > 0 && <>({idString})</>}
{subheader.length > 0 && <Header.Subheader>{subheader}</Header.Subheader>}
</Header>
<Overridable
id="ReactInvenioForms.AffiliationsSuggestions.content"
creatibutor={creatibutor}
isOrganization={isOrganization}
idString={idString}
makeSubheader={makeSubheader}
makeIdEntry={makeIdEntry}
>
<Header>
{name} {idString.length > 0 && <>({idString})</>}
{subheader.length > 0 && <Header.Subheader>{subheader}</Header.Subheader>}
</Header>
</Overridable>
),
};
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/forms/RemoteSelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class RemoteSelectField extends Component {
this.setState((prevState) => ({
suggestions: _uniqBy(
[...prevState.selectedSuggestions, ...serializedSuggestions],
"value"
"key"
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, kinda ... with "duplicated" names values we will have 2 times the same "value" for the actual name and since we use _uniqBy it will be only display one value, therefore changing to the key which is the id will avoid this issue

),
isFetching: false,
error: false,
Expand Down
Loading