-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
feat: Instant refresh views #2901
feat: Instant refresh views #2901
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AshAman999!
I'm just commenting, as it's just a draft.
I'm not sure your description of the PR is correct: on an existing product, if you go on the big edit page, change the category, go back to the big edit page and go to category, this works as expected: the category you chose earlier is pre-selected, right?
I suspect the problem is with new products, where (maybe) the product is not immediately saved on the server (and therefore refreshed locally) before all mandatory fields are input (which may not be done in one single edit, I don't know).
One problem here is probably a mix between the offline mode (with its tasks) and the normal mode in the rest of the app (we call the server, the server saves the product, we refresh from the server, the consumer/provider is called, the product data is refreshed in the whole app).
It would be safe to build the offline mode / task on top of something that works. Mixing both is perhaps confusing.
My suggestion: make it work ignoring the offline mode (cf. EditProductPage
), then make it work with the offline mode on top.
@monsieurtanuki Record_2022-09-02-18-02-25.mp4 |
@abughalib This issue does not happen on the other edit detail pages, like "edit categories". |
Bonjour @monsieurtanuki Yeah agreed, some things were working fine earlier as you're suggesting My solution was to, as we already know what fields we change
We can, we just update the product in the local database and the change the set/view with provider accordingly so in case if our queries take time to be done (and also I can't update state from background) it gives the user immediate results that at least their changes did happen, and it appears also. I am just stuck on the I Hope this clears some confusion about what this pr was intended for, |
Hi @AshAman999!
So don't use |
8d36827
to
3b383f1
Compare
Codecov Report
@@ Coverage Diff @@
## develop #2901 +/- ##
==========================================
+ Coverage 6.71% 6.88% +0.17%
==========================================
Files 228 229 +1
Lines 11117 11138 +21
==========================================
+ Hits 746 767 +21
Misses 10371 10371
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hello @monsieurtanuki For something that actually listens to the change from the database on that screen, I thought of other ideas Surely there can be better options than running periodic function, but for now, this is the only solution I was able to come up with, I could create a pr for that if you say, Meanwhile, this pr would solve some of the problems for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @AshAman999 for having applied the suggested changes to SimpleInputPage
.
If you could apply the same kind of changes in the other 3 pages that would be perfect for results and maintenance; the key is to have a method that changes the product, that can be applied to a full cached product or a minimalist product.
packages/smooth_app/lib/pages/product/nutrition_page_loaded.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AshAman999 We're close!
But I insist that using the same coding pattern for the same actions in the 4 pages makes sense, consistency-wise, effectivity-wise and maintenance-wise.
You'll find my detailed remarks.
packages/smooth_app/lib/pages/product/edit_ingredients_page.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/add_basic_details_page.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/nutrition_page_loaded.dart
Outdated
Show resolved
Hide resolved
Bonjour @monsieurtanuki Phew 😓 , Finally was able to understand the code for nutrient fields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @AshAman999 for your work!
In a next PR we will refactor those classes for some consistency (e.g. same getChangedProduct
method names), but for the moment it's fine!
add_basic_details_page
Co-authored-by: Abu Ghalib <abughalib@users.noreply.github.com>
25214bd
to
e73f7a9
Compare
Ok, it seems work is still ongoing on the PR. Waiting for a while before merging. |
It's done, and approved |
I've already reviewed (many many times) this code. I approved it this morning. |
Real Sorry about this @monsieurtanuki I just rebased the pr on the latest changes, Better be careful about this next time. |
What
Instantly update views on product edit
Steps
This pr would fix those problems
Screen Recording
20220905_011032.mp4
Part of