From 41faa4f965484c1cb988973fddaeb889274ab38c Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Tue, 1 Oct 2024 15:15:07 +0200 Subject: [PATCH] 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. --- .../fields/AccessField/components/ProtectionButtons.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/fields/AccessField/components/ProtectionButtons.js b/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/fields/AccessField/components/ProtectionButtons.js index 6cfe988d4..b3ec39d77 100644 --- a/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/fields/AccessField/components/ProtectionButtons.js +++ b/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/fields/AccessField/components/ProtectionButtons.js @@ -1,7 +1,7 @@ // This file is part of Invenio-RDM-Records // Copyright (C) 2020-2023 CERN. // Copyright (C) 2020-2022 Northwestern University. -// Copyright (C) 2021 Graz University of Technology. +// Copyright (C) 2021-2024 Graz University of Technology. // // Invenio-RDM-Records is free software; you can redistribute it and/or modify it // under the terms of the MIT License; see LICENSE file for more details. @@ -109,7 +109,11 @@ export class ProtectionButtons extends Component { } } +ProtectionButtons.defaultProps = { + canRestrictRecord: true, +}; + ProtectionButtons.propTypes = { - canRestrictRecord: PropTypes.bool.isRequired, + canRestrictRecord: PropTypes.bool, fieldPath: PropTypes.string.isRequired, };