Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid breaking selects [DHIS2-16264] #1963

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Conversation

KaiVandivier
Copy link
Contributor

@KaiVandivier KaiVandivier commented Dec 12, 2023

https://dhis2.atlassian.net/browse/DHIS2-16264

The select components do a fetch on render for attributes to populate some options (the top two or three are hard-coded though). If you select an option that was populated by the fetch, that value is saved in the Final Form state. If you collapse the Advanced Options section, then re-expand the section, the select tries to choose the option based on that value, but the component needs to fetch again, so that option isn't available on first render

Edited:
I changed the <MoreOptions> component to keep children rendered to preserve state, and then hide them with CSS

Before:

before.mov

After:

after.mov

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Dec 12, 2023

🚀 Deployed on https://pr-1963--dhis2-import-export.netlify.app

@Mohammer5
Copy link
Contributor

There are other ways to redesign things that manage data and time-to-first-render a bit more optimally, but I think this week is about quick and simple

In that case we should add another Jira issue so we don't forget about it

Copy link
Contributor

@Mohammer5 Mohammer5 left a comment

Choose a reason for hiding this comment

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

LGTM, as I said, I think we should add another Jira issue so we know that the UX of the advanced options section can be improved

@KaiVandivier KaiVandivier force-pushed the DHIS2-16264-fix-selects branch from 252586f to b2f0e02 Compare December 15, 2023 15:20
@KaiVandivier KaiVandivier changed the title fix: handle fetch loading condition to avoid breaking [DHIS2-16264] fix: avoid breaking selects [DHIS2-16264] Dec 15, 2023
@KaiVandivier KaiVandivier merged commit 4300ef2 into master Dec 15, 2023
10 checks passed
@KaiVandivier KaiVandivier deleted the DHIS2-16264-fix-selects branch December 15, 2023 16:12
dhis2-bot added a commit that referenced this pull request Dec 15, 2023
## [1.5.66](v1.5.65...v1.5.66) (2023-12-15)

### Bug Fixes

* avoid breaking selects [DHIS2-16264] ([#1963](#1963)) ([4300ef2](4300ef2))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 1.5.66 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

KaiVandivier added a commit that referenced this pull request Dec 15, 2023
* fix: loading logic

* fix: hide stateful selects to preserve state

* chore: format

* chore: update snapshots
KaiVandivier added a commit that referenced this pull request Dec 15, 2023
* fix: loading logic

* fix: hide stateful selects to preserve state

* chore: format

* chore: update snapshots
KaiVandivier added a commit that referenced this pull request Dec 15, 2023
* fix: loading logic

* fix: hide stateful selects to preserve state

* chore: format

* chore: update snapshots
KaiVandivier added a commit that referenced this pull request Dec 15, 2023
* fix: loading logic

* fix: hide stateful selects to preserve state

* chore: format

* chore: update snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants