Skip to content

Commit 41faa4f

Browse files
utnapischtimfenekku
authored andcommitted
fix: propTypes warning
* the canRestrictRecord property is optional in ProtectionButtonsComponent but required in ProtectionButtons. * Since it is working without a problem, because of the default value in ProtectionButtonsComponent, the required has been removed from ProtectionButtons and replaced by a defaultProps definition to be consistent with the ProtectionButtonsComponent definition.
1 parent 76a739a commit 41faa4f

File tree

1 file changed

+6
-2
lines changed
  • invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/fields/AccessField/components

1 file changed

+6
-2
lines changed

invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/fields/AccessField/components/ProtectionButtons.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is part of Invenio-RDM-Records
22
// Copyright (C) 2020-2023 CERN.
33
// Copyright (C) 2020-2022 Northwestern University.
4-
// Copyright (C) 2021 Graz University of Technology.
4+
// Copyright (C) 2021-2024 Graz University of Technology.
55
//
66
// Invenio-RDM-Records is free software; you can redistribute it and/or modify it
77
// under the terms of the MIT License; see LICENSE file for more details.
@@ -109,7 +109,11 @@ export class ProtectionButtons extends Component {
109109
}
110110
}
111111

112+
ProtectionButtons.defaultProps = {
113+
canRestrictRecord: true,
114+
};
115+
112116
ProtectionButtons.propTypes = {
113-
canRestrictRecord: PropTypes.bool.isRequired,
117+
canRestrictRecord: PropTypes.bool,
114118
fieldPath: PropTypes.string.isRequired,
115119
};

0 commit comments

Comments
 (0)