Skip to content

Commit

Permalink
refactor: Refactor tweaks
Browse files Browse the repository at this point in the history
Moved connected component outside of component render, removed default values
  • Loading branch information
EthanFreestone committed Apr 12, 2024
1 parent 79e4c34 commit 5e4e4c2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Settings/NumberGeneratorOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { Field } from 'react-final-form';

import { stripesConnect, withStripes } from '@folio/stripes/core';
import {
stripesConnect,
withStripes,
} from '@folio/stripes/core';
import { ConfigManager } from '@folio/stripes/smart-components';

import { Col, RadioButton, Row } from '@folio/stripes/components';

const NumberGeneratorOptions = (props) => {
const ConnectedConfigManager = stripesConnect(ConfigManager);

const defaultValues = {
useGenerator: 'useBoth',
};
const ConnectedConfigManager = stripesConnect(ConfigManager);

const NumberGeneratorOptions = (props) => {
const beforeSave = (data) => {
return JSON.stringify(data);
};
Expand All @@ -32,7 +31,6 @@ const NumberGeneratorOptions = (props) => {
}

return {
...defaultValues,
...loadedValues,
};
};
Expand All @@ -41,11 +39,11 @@ const NumberGeneratorOptions = (props) => {
<ConnectedConfigManager
configName="number_generator"
getInitialValues={getInitialValues}
formType="final-form"
label={<FormattedMessage id="ui-organizations.settings.numberGeneratorOptions" />}
moduleName="ORGANIZATIONS"
onBeforeSave={beforeSave}
stripes={props.stripes}
formType="final-form"
>
<Row>
<Col xs={12}>
Expand Down

0 comments on commit 5e4e4c2

Please sign in to comment.