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

Investigate if we need to re-forward properties #90

Closed
nomego opened this issue Sep 26, 2019 · 2 comments · Fixed by #101
Closed

Investigate if we need to re-forward properties #90

nomego opened this issue Sep 26, 2019 · 2 comments · Fixed by #101
Assignees

Comments

@nomego
Copy link
Contributor

nomego commented Sep 26, 2019

When implementing "realign" for scenarios where items disappear from the item list, but other items that are rendered should stay intact (

_realignElements(index) { // eslint-disable-line max-statements
), we also re-forward the properties (
Object.keys(props).forEach(key => instance._setPendingProperty(key, props[key]));
+ 620).

This causes us to actually re-stamp/re-eval the same instance, which in turn, in some cases, causes the views to re-request information from BE unnecessarily.

Can we safely drop this property forwarding for existing, rendered elements or why is it there in the first place?

This can be tested in Cosmoz FE view "Purchase -> Orders -> Orders rows with quantity differences" -> Queue -> action "Approve order row".
You will notice that history and suggestions are called twice, even though we only request information for one new row.

@cristinecula
Copy link
Collaborator

@nomego I tried disabling the prop forwarding, by removing those lines in _realignElements, but (aside from causing errors in the tests) the multiple requests for the same id appear to continue to be happening.
The data-nav logic is very complex and hard to follow, so more investigation is needed.
In the long run, I think separating the data layer from the view layer would result in more benefits, than patching this library. The view layer should not make API requests directly, but instead only display the data. If we do this correctly, then we can forward props all the time, without triggering network requests.

cristinecula added a commit that referenced this issue Oct 30, 2019
github-actions bot pushed a commit that referenced this issue Oct 31, 2019
## [3.0.6](v3.0.5...v3.0.6) (2019-10-31)

### Bug Fixes

* 🐛 data-nav related props are not updated when realigned ([3449d62](3449d62))
* do not update instance if it was realigned ([7cc1b8d](7cc1b8d)), closes [#90](#90)
@github-actions
Copy link

🎉 This issue has been resolved in version 3.0.6 🎉

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants