Skip to content

[MDS-6622] Re-rendering bug#3673

Merged
taraepp merged 6 commits intodevelopfrom
mds-6622-rerendering-bug
Sep 18, 2025
Merged

[MDS-6622] Re-rendering bug#3673
taraepp merged 6 commits intodevelopfrom
mds-6622-rerendering-bug

Conversation

@taraepp
Copy link
Contributor

@taraepp taraepp commented Sep 16, 2025

Objective

  • stop the rerendering from happening...
  • by defaulting forms in "view mode" to not use redux form
  • still pass in a prop to allow them to use redux anyway because some existing forms are really dependent on redux-form state

MDS-6622

const hasValue = value !== "";
const displayValue = hasValue ? value.toString() : EMPTY_FIELD;

const valueElement = displayOverride && hasValue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just annoyed wanting to show a list of values and wanted to be able to customize that to not be a paragraph. Only change here.

formClassName,
}) => {

const dispatch = useDispatch();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really not significantly different than existing FormWrapper, extracted this out from there

if (!isEditMode && forceRedux) {
return getFormValues(props.name)(state);
}
return props.initialValues;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keeping values fresh so that view forms that call change and similar function properly. 🤦‍♀️

showTimezones,
} = props;

const { isEditMode } = useContext(FormContext);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did some little view modes for input types that didn't have them yet

import RenderTreeSelect from "./RenderTreeSelect";
import { normalizeDatetime } from "@mds/common/redux/utils/helpers";

const initialValues = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the big test!
Put in all the input components. Did some field nesting. Make sure something sensible is returned (nothing crashes, values show up). Couple things I decided not to worry about because nowhere in the system does it matter (RenderCascader, Fields). If it becomes necessary in the future we'll deal with it then.

const { id, tab } = useParams<{ id: string, tab: string }>();
const showNullScreen = !location.state && !id;
const [fixedTop, setFixedTop] = useState(false);
const fixedTopRef = React.useRef(fixedTop);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up converting this one to TS first. Aaaand I should probably have brought the fixedTopRef bit over to ScrollSidePageWrapper. Kept it because it was done and it works.

const formErrors = useSelector(getFormSubmitErrors(name));

const handleSubmit = async (values) => {
console.log('handleSubmit', name, values)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed log

Copy link
Collaborator

@matbusby-fw matbusby-fw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Just found the one console log still there.

sggerard
sggerard previously approved these changes Sep 17, 2025
Copy link
Contributor

@sggerard sggerard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appears to work great!

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'bcgov-sonarcloud_mds_minespace-web'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_common'

Failed conditions
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_core-web'

Failed conditions
14.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@taraepp taraepp merged commit 76eaeeb into develop Sep 18, 2025
15 of 17 checks passed
@taraepp taraepp deleted the mds-6622-rerendering-bug branch September 18, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants