Skip to content

Commit

Permalink
[fix] proptypes runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shellyear committed Mar 8, 2024
1 parent 39df32f commit a91693e
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/components/HorizontalInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class HorizontalInput extends React.Component {
possibleValueQuery: PropTypes.string,
// checkboxes and radios
iconRight: PropTypes.object,
children: PropTypes.node.isRequired,
children: PropTypes.node,
};

static defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const LoaderCard = (props) => (
);

LoaderCard.propTypes = {
header: PropTypes.elementType,
header: PropTypes.object,
};

export const LoaderSmall = () => <div className="loader align-self-center" />;
2 changes: 1 addition & 1 deletion src/components/institution/InstitutionTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PropTypes from "prop-types";

class InstitutionTable extends React.Component {
static propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
institutions: PropTypes.array.isRequired,
handlers: PropTypes.object.isRequired,
institutionDeleted: PropTypes.object,
Expand Down
4 changes: 2 additions & 2 deletions src/components/institution/InstitutionsController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ InstitutionsController.propTypes = {
currentUser: PropTypes.shape({
role: PropTypes.string.isRequired,
}).isRequired,
institutionsLoaded: PropTypes.bool.isRequired,
institutionDeleted: PropTypes.bool.isRequired,
institutionsLoaded: PropTypes.object,
institutionDeleted: PropTypes.object,
};

export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(withI18n(InstitutionsController)));
Expand Down
4 changes: 2 additions & 2 deletions src/components/login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ class Login extends React.Component {
}

Login.propTypes = {
login: PropTypes.object,
login: PropTypes.func,
error: PropTypes.object,
isLogging: PropTypes.bool,
i18n: PropTypes.object.isRequired, // Or whichever type 'i18n' is
i18n: PropTypes.func,
};

export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(withI18n(Login)));
Expand Down
16 changes: 8 additions & 8 deletions src/components/record/RecordController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,22 @@ class RecordController extends React.Component {
RecordController.propTypes = {
match: PropTypes.shape({
params: PropTypes.shape({
key: PropTypes.string.isRequired,
key: PropTypes.string,
}).isRequired,
}).isRequired,
loadRecord: PropTypes.func.isRequired,
recordSaved: PropTypes.shape({
actionFlag: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
actionFlag: PropTypes.string,
status: PropTypes.string,
record: PropTypes.shape({
key: PropTypes.string.isRequired,
}).isRequired,
key: PropTypes.string,
}),
}).isRequired,
recordLoaded: PropTypes.shape({
status: PropTypes.string.isRequired,
status: PropTypes.string,
record: PropTypes.shape({
state: PropTypes.string.isRequired,
}).isRequired,
state: PropTypes.object,
}),
}).isRequired,
unloadSavedRecord: PropTypes.func.isRequired,
transitionToWithOpts: PropTypes.func.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/RecordForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class RecordForm extends React.Component {
}

RecordForm.propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
record: PropTypes.object.isRequired,
currentUser: PropTypes.object.isRequired,
loadFormgen: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/RecordTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RecordTable extends React.Component {
formatMessage: PropTypes.func,
locale: PropTypes.string,
}),
i18n: PropTypes.object,
i18n: PropTypes.func,
recordsLoaded: PropTypes.object.isRequired,
formTemplate: PropTypes.string,
formTemplatesLoaded: PropTypes.object.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/Records.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const STUDY_CREATE_AT_MOST_ONE_RECORD = false;

class Records extends React.Component {
static propTypes = {
i18n: PropTypes.object.isRequired,
i18n: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
recordsLoaded: PropTypes.object,
recordDeleted: PropTypes.object,
Expand Down
10 changes: 5 additions & 5 deletions src/components/record/RecordsController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ RecordsController.propTypes = {
importRecords: PropTypes.func.isRequired,
formTemplatesLoaded: PropTypes.object.isRequired,
recordsLoaded: PropTypes.shape({
records: PropTypes.array.isRequired,
pageCount: PropTypes.number.isRequired,
}).isRequired,
recordDeleted: PropTypes.func.isRequired,
recordsDeleting: PropTypes.bool.isRequired,
records: PropTypes.array,
pageCount: PropTypes.number,
}),
recordDeleted: PropTypes.object,
recordsDeleting: PropTypes.array,
currentUser: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/RequiredAttributes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { isAdmin } from "../../utils/SecurityUtils";

class RequiredAttributes extends React.Component {
static propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
record: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
completed: PropTypes.bool.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions src/components/record/filter/DateIntervalFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ const DateIntervalFilter = ({ minDate, maxDate, sort, onChange }) => {
};

DateIntervalFilter.propTypes = {
minDate: PropTypes.instanceOf(Date).isRequired,
maxDate: PropTypes.instanceOf(Date).isRequired,
minDate: PropTypes.instanceOf(Date),
maxDate: PropTypes.instanceOf(Date),
sort: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/filter/InstitutionFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const InstitutionFilter = ({ value, onChange }) => {
};

InstitutionFilter.propTypes = {
value: PropTypes.string.isRequired,
value: PropTypes.string,
onChange: PropTypes.func.isRequired,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/record/filter/PhaseFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const PhaseFilter = ({ value, onChange }) => {
};

PhaseFilter.propTypes = {
value: PropTypes.string.isRequired,
value: PropTypes.string,
onChange: PropTypes.func.isRequired,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/user/UserTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import IfInternalAuth from "../misc/oidc/IfInternalAuth";

class UserTable extends React.Component {
static propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
users: PropTypes.array.isRequired,
handlers: PropTypes.object.isRequired,
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/user/UsersController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ UsersController.propTypes = {
currentUser: PropTypes.shape({
role: PropTypes.string.isRequired,
}).isRequired,
usersLoaded: PropTypes.bool.isRequired,
userDeleted: PropTypes.bool.isRequired,
usersLoaded: PropTypes.object,
userDeleted: PropTypes.object,
};

export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(withI18n(UsersController)));
Expand Down

0 comments on commit a91693e

Please sign in to comment.