pinia-orm icon indicating copy to clipboard operation
pinia-orm copied to clipboard

fix: update vue 2 reactivity

Open Graphmaxer opened this issue 1 year ago • 9 comments

🔗 Linked issue

https://github.com/CodeDredd/pinia-orm/issues/1772

❓ Type of change

  • [ ] 📖 Documentation (updates to the documentation or readme)
  • [x] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ ] 👌 Enhancement (improving an existing functionality like performance)
  • [ ] ✨ New feature (a non-breaking change that adds functionality)
  • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

When updating an object in Vue 2, we cannot use directly Object.assign with 2 params and delete is not reactive.

cf. https://v2.vuejs.org/v2/guide/reactivity.html#For-Objects

📝 Checklist

  • [x] I have linked an issue or discussion.
  • [x] I have updated the documentation accordingly.

Graphmaxer avatar Feb 01 '24 17:02 Graphmaxer

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (a7ab3bf) 99.10% compared to head (b289c7b) 98.94%. Report is 5 commits behind head on main.

Files Patch % Lines
...kages/pinia-orm/src/composables/useStoreActions.ts 70.58% 10 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1773      +/-   ##
==========================================
- Coverage   99.10%   98.94%   -0.17%     
==========================================
  Files          90       90              
  Lines        5917     5946      +29     
  Branches      494      499       +5     
==========================================
+ Hits         5864     5883      +19     
- Misses         50       60      +10     
  Partials        3        3              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Feb 02 '24 14:02 codecov-commenter

I don't know how to have 100% of code coverage with Vue 2 conditions, maybe it's possible to combine multiple reports with nyc https://github.com/istanbuljs/nyc?tab=readme-ov-file#combining-reports-from-multiple-runs

Graphmaxer avatar Feb 02 '24 16:02 Graphmaxer

Some tests are failing with test:2 :/

Graphmaxer avatar Feb 05 '24 09:02 Graphmaxer

@Graphmaxer Thanks for the PR. I try to look into it and think about it. I don't like it to have a new package as dependency. I hopefully find a solution to your problem. Meanwhile it would be good if could write a test for this.

CodeDredd avatar Feb 06 '24 08:02 CodeDredd

I updated the test performance/prevent_rerender_of_child_components to be compatible with Vue 2 and it is failing because of a lack of reactivity. This test is already testing the bug.

Graphmaxer avatar Feb 07 '24 09:02 Graphmaxer

I found a proper way without vue-demi as a direct dependency and added a specific tests to test reactivity and it is working great :)

Graphmaxer avatar Feb 09 '24 10:02 Graphmaxer

Thanks for your PR, it works well for me, reactivity is working again! Tested on 2.7.16.

phillipfickl avatar Feb 13 '24 16:02 phillipfickl

Any update on the review @CodeDredd ?

Graphmaxer avatar Feb 21 '24 14:02 Graphmaxer

@CodeDredd if you found a minute to review and release this, I'd really appreciate it! Thanks for your time

phillipfickl avatar Mar 04 '24 12:03 phillipfickl