Comments (8)
@daleshort Thanks for pointing out this bug. When I added the toRaw
props enclosure, I didn't realise that the props were no longer fully reactive.
However, it is not as simple as just removing the toRaw
, because it has a reason.
If you remove rowRaw
and add a thAttrs
or tdAttrs
property as a template prop, a "Maximum recursive updates exceeded" error is thrown.
Add this to any o-table-column
component from the docs (I tested it with the detailed example):
<o-table-column
...
:th-attrs="(column) => ({ 'data-col': column.field })"
:td-attrs="(row) => ({ 'data-id': row.id })">
...
</o-table-column>
from oruga.
In that case I updated the PR with a more narrow approach.
from oruga.
(and tested it with ThAttrs and tdAttrs)
from oruga.
I admit this is a problem, but I would like to fix it in such a way that all or atleast all of the function props become reactive again. But I don't know how... (without setting all props one by one in the computed function)
from oruga.
I actually can't reproduce the infinite update error. Here is why I'm doing to try and reproduce the issue with spreading just props.
Firefox 124.0.1
Vue 3.4.21 (also tried 3.2 but no error)
in TableColumn
`const providedData = computed(() => {
console.log("providedDataRefresh2");
return {
...props,
$el: vm.proxy,
$slots: vm.slots,
style: style.value,
isHeaderUnselectable: isHeaderUnselectable.value,
};
});`
in Table detail example:
<o-table
ref="table"
:data="data"
detailed
hoverable
:custom-detail-row="!showDefaultDetail"
:opened-detailed="['Board Games']"
:default-sort="['name', 'asc']"
detail-key="name"
:show-detail-icon="showDetailIcon"
:th-attrs="(column) => ({ 'data-col': column.field })"
:td-attrs="(row) => ({ 'data-id': row.id })"
>
I was hoping to see if I could find another way.
I understand where you're coming from but in the absence of a more elegant solution, and given this is breaking your own examples (and in our production code), I'd strongly vote for the pragmatic fix of listing the props that can be reactive in the computed. It can always be improved later, and it's not like the props aren't already explicitly enumerated in the props declaration 10 lines above or somehow a naive user could introduce a new prop that wouldn't be listed in the computed.
from oruga.
You have to set the thAttrs and tdAttrs to a o-table-column
component not the o-table
, and only if the function is a inline function in the template, not when its a defined function in the script block.
I confirm your point, and the pragmatic fix will be introduced in the next release, which came in the near future.
from oruga.
ah sorry. Thanks for bearing with me. I can reproduce it now. I tried some stuff but nothing worked nor am I an expert in the advanced reactivity features.
Thanks for your consideration.
from oruga.
Not for the fix, but for 0.9, I consider moving thAttrs and tdAttrs as property to o-table, then the problem could be solved, and ...props
can be used again in the computed function of the table-column. And this might not be a big change because the row and column are given as props anyway.
from oruga.
Related Issues (20)
- [Component]: Breadcrumb HOT 1
- Unable to disable animation on `Tabs` component
- Can't reset the sorting of the table component HOT 1
- Autocomplete: make vmodel be the selected option HOT 1
- Datepicker component no longer editable HOT 4
- Error undefined value when clicking menu item
- Taginput with autocomplete does not work if data is an array of objects HOT 2
- Taginput: cannot remove custom items, no removeItem() function HOT 6
- Add way to skip all or part of components registration HOT 2
- Cannot select a o-field component using getByRole and an accessible name HOT 8
- Datepicker: custom classes props are ignored HOT 4
- Text input broken for horizontal fields HOT 4
- Infinite recursive update freezing the browser when updating asynchronously a TagInput model value HOT 3
- HTML5 required validity does not work with OSelect component with a placeholder HOT 1
- datetimepicker: Editing directly the datetime value does nothing HOT 4
- Expanded prop not working on o-input
- Feature(table) : Give access to filtered table length
- TagInput: regressions with maxitems and tag removal
- Support custom constraint validation (setCustomValidity) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oruga.