Commit 6996ccfd authored by David Björkheim's avatar David Björkheim
Browse files

DEICH-5554 Deichman.no: Update proptypes + react keys

parent 9df23ca0
......@@ -4,7 +4,7 @@ import { Accordion, Block } from "@digibib/deichman-ui";
export default function PublicationAccordionContainer({ publicationId }) {
return (
<Block top={8}>
<Accordion text="Andre utgivelser" openByDefault large showDividers>
<Accordion text="Andre utgaver" openByDefault large showDividers>
<div>TODO IMPLEMENT ME</div>
{/* <Block top={5}>
<ActiveFilters type="publication" />
......
......@@ -264,15 +264,11 @@ class ReservationContainer extends React.Component {
}
ReservationContainer.defaultProps = {
data: {},
homeBranch: "",
userCategory: ""
};
ReservationContainer.propTypes = {
isVisible: PropTypes.bool.isRequired,
isLoggedIn: PropTypes.bool.isRequired,
data: PropTypes.object,
copies: PropTypes.object,
branches: PropTypes.array.isRequired,
homeBranch: PropTypes.string,
......@@ -281,8 +277,7 @@ ReservationContainer.propTypes = {
resetReservationError: PropTypes.func.isRequired,
reservePublication: PropTypes.func.isRequired,
remoteReservePublication: PropTypes.func.isRequired,
toggleReservations: PropTypes.func.isRequired,
publication: PropTypes.object.isRequired,
publications: PropTypes.arrayOf(PropTypes.object).isRequired,
reservationApi: PropTypes.object.isRequired,
work: PropTypes.object.isRequired
};
......
......@@ -59,7 +59,11 @@ export default function ReservePublicationWidget({
const showFields = matchMedia(availableFields, mediaType);
useEffect(
() => {
getCopies(currentPublication).then(newCopies => setCopies(newCopies));
let cancelUpdate = false;
getCopies(currentPublication).then(
newCopies => !cancelUpdate && setCopies(newCopies)
);
return () => (cancelUpdate = true);
},
[currentPublication]
);
......@@ -151,8 +155,12 @@ export default function ReservePublicationWidget({
<div>
{reserveChoices.map(choice => {
return (
<fieldset disabled={choice.alternatives.length <= 1}>
<fieldset
key={choice.choice}
disabled={choice.alternatives.length <= 1}
>
<Select
name={choice.choice}
options={choice.alternatives}
onChange={choice.onChange}
selected={choice.selected}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment