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: clear sync-status when value changes #182

Merged
merged 8 commits into from
Sep 29, 2022

Conversation

Birkbjo
Copy link
Member

@Birkbjo Birkbjo commented Sep 18, 2022

I've moved the syncStatus to use react-final-form mutator, and instead of manually setting synced: true, we're calculating the syncStatus based on the lastSyncedValue.
It can be argued whether it's necessary to have lastSyncedValue in the meta.data using mutators - since we could've just used the previous setSyncStatus. But this sets up the wiring required for setting syncErrors as well, and we might as well gather these in the meta.data. Also means that we can cleanup the deep passing of the syncStatus and setSyncStatus.

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Sep 18, 2022

🚀 Deployed on https://pr-182--dhis2-data-entry.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify September 18, 2022 15:37 Inactive
@tomzemp
Copy link
Member

tomzemp commented Sep 19, 2022

Looks good, but I wonder if we need to address cases where the cell gets updated back to its previously synced value?

e.g. I have a cell with synced value 25, I click on it and change it to 250 (the synced status indicator disappears), I delete the 0 and change it back to 25. Now nothing gets posted back, and I've lost the synced status indicator:

previous_synced

I think it's more central to locate this logic in InnerWrapper, but also wonder if it would be helpful to put it in the individual input components, so that it's handled along with the logic for updating/syncing values?

@Birkbjo
Copy link
Member Author

Birkbjo commented Sep 19, 2022

but I wonder if we need to address cases where the cell gets updated back to its previously synced value?

Yeah, I was just thinking that we should handle this. Will put the PR in draft-mode until I've had a change to fix that.

@Birkbjo Birkbjo marked this pull request as draft September 19, 2022 08:35
@Birkbjo Birkbjo force-pushed the fix/reset-synced-status-on-change branch 2 times, most recently from 87e58ab to 7425972 Compare September 25, 2022 21:51
@dhis2-bot dhis2-bot temporarily deployed to netlify September 25, 2022 21:54 Inactive
@Birkbjo Birkbjo force-pushed the fix/reset-synced-status-on-change branch from 8afbe38 to 9813abf Compare September 25, 2022 21:56
@dhis2-bot dhis2-bot temporarily deployed to netlify September 25, 2022 22:32 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify September 25, 2022 23:06 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify September 25, 2022 23:32 Inactive
@Birkbjo Birkbjo marked this pull request as ready for review September 27, 2022 09:55
@Birkbjo Birkbjo force-pushed the fix/reset-synced-status-on-change branch from f15bbfb to c0a8483 Compare September 27, 2022 09:56
@dhis2-bot dhis2-bot temporarily deployed to netlify September 27, 2022 10:00 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify September 27, 2022 11:02 Inactive
@Birkbjo
Copy link
Member Author

Birkbjo commented Sep 27, 2022

By @Birkbjo:

will come back to this, but pretty low priority, think it’s something we might want, but after refactor to display: none its very fast as is

@Mohammer5 that was referring to #88 , not this one.

EDIT by @Mohammer5: Oh sorry.. Corrected my mistake

@Birkbjo Birkbjo force-pushed the fix/reset-synced-status-on-change branch from c0cfba7 to 881e465 Compare September 27, 2022 11:55
@dhis2-bot dhis2-bot temporarily deployed to netlify September 27, 2022 11:57 Inactive
Copy link
Contributor

@HendrikThePendric HendrikThePendric left a comment

Choose a reason for hiding this comment

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

In general I think the approach of storing this type of data in the data property of the RFF Field is perfect. I do wonder about one implementation detail and left a comment in the code about that.

@Birkbjo Birkbjo force-pushed the fix/reset-synced-status-on-change branch from 881e465 to 1779a81 Compare September 29, 2022 20:48
@dhis2-bot dhis2-bot temporarily deployed to netlify September 29, 2022 20:50 Inactive
@Birkbjo Birkbjo merged commit d4d6d29 into development Sep 29, 2022
dhis2-bot added a commit that referenced this pull request Oct 21, 2022
# [100.1.0](v100.0.0...v100.1.0) (2022-10-21)

### Bug Fixes

* adjust client time to server timezone when computing date ranges ([#165](#165)) ([af3fa39](af3fa39))
* adjust synced cell style ([#199](#199)) ([32a9d78](32a9d78))
* allow for unit paths starting at the real root instead of user root ([#197](#197)) ([0191551](0191551))
* clear sync-status when value changes ([#182](#182)) ([d4d6d29](d4d6d29))
* ensure offline units are fetched correctly for users deep in the hierarchy ([#226](#226)) ([d9d4632](d9d4632))
* fix disabled cell styling [TECH-1466] ([#234](#234)) ([0334733](0334733))
* global filter field size ([#221](#221)) ([7b003d8](7b003d8))
* handle inconsistent formats from api for orgUnits [DHIS2-13888] ([#210](#210)) ([ab266ca](ab266ca))
* handle invalid parameters in URL [TECH-1382] [TECH-1384] ([#208](#208)) ([3c14bd8](3c14bd8))
* handle temporal mutation errors ([#206](#206)) ([0bb923d](0bb923d))
* highlighted fields performance ([#155](#155)) ([554025c](554025c))
* import locales so app has access to them ([#207](#207)) ([662ddc6](662ddc6))
* make bottom bar buttons small [DHIS2-13956] ([c507860](c507860))
* make useDataValueParams and useApiAttributeParams stable ([978a7b9](978a7b9))
* manage unsaved comments when moving cells ([b04cbfd](b04cbfd))
* manage unsaved limits when moving cells ([dd14d41](dd14d41))
* or between shortcuts [DHIS2-13955] ([d71a93b](d71a93b))
* print styles [TECH-1312] ([#217](#217)) ([5533e00](5533e00))
* remove defaultOnSuccess for queries ([75e257e](75e257e))
* rerun validation on main bar button click ([d62e4a0](d62e4a0))
* stop tooltip flickering [DHIS2-13954] ([0c44cb5](0c44cb5))
* update variable name [TECH-1465] ([#231](#231)) ([1fd682f](1fd682f))
* **audit history:** update processing, clean up [TECH-1281] ([#131](#131)) ([7464efb](7464efb))
* **basic information:** display client date in tooltip ([da867a7](da867a7))
* **data-value-set:** disable when mutating ([85e7cbc](85e7cbc))
* **dates:** use server time when appropriate ([b8cbdbc](b8cbdbc))
* **deps:** pin dependencies ([35fdd45](35fdd45))
* **deps:** update dependency @dhis2/app-runtime to v3.5.0 ([#224](#224)) ([f532607](f532607))
* **deps:** update dependency @dhis2/ui to v8.5.3 ([#225](#225)) ([7b27ee1](7b27ee1))
* **filter-field:** hide clear-button when no filter ([#222](#222)) ([64b08dc](64b08dc))
* remove custom styles for data details button ([e47d519](e47d519))
* update Add limits styling [DHIS2-13958] ([2f528ba](2f528ba))
* **translations:** sync translations from transifex (development) ([76859da](76859da))
* **translations:** sync translations from transifex (development) ([db5b088](db5b088))
* **translations:** sync translations from transifex (development) ([9724342](9724342))
* **use date limit:** prevent recomputing on every re-render ([68dbbcb](68dbbcb))
* **validation button:** disable validation run when offline [TECH-1377] ([#178](#178)) ([7838601](7838601))
* use a stable date string instead of an instable date instance ([#201](#201)) ([dea42b1](dea42b1))

### Features

* **headerbar:** integrate offline-status message ([#233](#233)) ([58f042e](58f042e))
* sync error handling ([#218](#218)) ([cf3e542](cf3e542))
* **client server date:** add DRY utils ([7153fe3](7153fe3))
* **get current date:** set milliseconds to 0 ([9fa0441](9fa0441))
* respect F_DATAVALUE_ADD user authority ([e91a847](e91a847))
* **custom forms:** notify user about pre-fetching failure ([9e8374f](9e8374f))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

4 participants