-
-
Notifications
You must be signed in to change notification settings - Fork 173
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(table): reorder params from Object.assign to allow for non-extensible objects #689
fix(table): reorder params from Object.assign to allow for non-extensible objects #689
Conversation
…ible objects Non-extensible objects (such as VueJS computed properties) don't allow to be extended with Object.assign(). By inverting the two parameters, we copy all the properties of the row to the new `{ __rowKey: uuid() }` object instead. Signed-off-by: Thomas Citharel <[email protected]>
✅ Deploy Preview for oruga-documentation-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #689 +/- ##
========================================
Coverage 51.93% 51.93%
========================================
Files 33 33
Lines 1396 1396
Branches 515 515
========================================
Hits 725 725
Misses 671 671
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@tcitworld Your change seems right to me, but I'll have a closer look in the next few weeks if I have the time :) |
if :data="data" is an array of typescript classes, these classes get somehow transformed into plain objects? In my classes I have methods that turn to errors like "TypeError: row.mycustomfunction is not a function", when "mycustomfunction" is one of the methods inside the class. You cannot use TS Classes at their full potential. Rolling back to previous version solve the problem to me. |
@Nemesis19 Could you explain your problem in more detail, maybe with some more example code? Should the methods of your typescript classes not be compiled to functions of a js object anyway? |
example of my user class, the o-table gets as :data an array of this Typescript Classes. The column where I'm using a class method method (row.data('something')) returns the error above.
example of o-table column, see
the problem is definitely in this merge, cause till 0.8.1 everything was working as expected and honestly I don't understand what this merge really fixes and it's purpose since o-table was a piece of art 😅...but whatever... It seems this update transforms a typescript class into a plain object, making the class to lose all the class features. |
@Nemesis19 We agree this is at all a bad concept. In the meantime, you might try implementing the specific function you want to call as a property with an anonymous function instead of a method. That way it is defined as a prop in the object. Perhaps this will solve your problem for now. |
Non-extensible objects (such as VueJS computed properties) don't allow to be extended with Object.assign(). By inverting the two parameters, we copy all the properties of the row to the new
{ __rowKey: uuid() }
object instead.Fixes
TypeError: can't define property "__rowKey": Object is not extensible