-
Notifications
You must be signed in to change notification settings - Fork 76
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
No rerender on a @tracked array update #340
Comments
oliverlj
changed the title
No rerender on a @tracked array
No rerender on a @tracked array update
Nov 28, 2021
@oliverlj How are you updating the array? If it's a native array, then you can't use the @tracked items = [];
addItem(item) {
// doesn't work
this.items.push(item)
// works
this.items = [...this.items, item];
} |
I'm using a js getter of a @Tracked property. Normal table is rerender, vertical collection not {{#if this.sortedTransactions}}
{{!-- {{#vertical-collection
this.sortedTransactions
containerSelector=".transax"
tagName="tbody"
estimateHeight="3rem"
staticHeight=true
class="tx-body"
as |tx|
}}
<tr class="line-height-tx">
<TxTable::TxItem @tx={{tx}} />
</tr>
{{/vertical-collection}} --}}
<tbody class="tx-body">
{{#each this.sortedTransactions as |tx|}}
{{#if this.state}}
<tr class="line-height-tx deactivate-line">
<TxTable::TxItem @tx={{tx}} />
</tr>
{{else}}
<tr class="line-height-tx">
<TxTable::TxItem @tx={{tx}} />
</tr>
{{/if}}
{{/each}}
</tbody>
{{else}} get sortedTransactions() {
if (this.catSortOrder !== SortOrder.NONE) {
return this.filteredTransactions.slice().sort(Sorts.text((tx: TxDatum) => tx.category, this.catSortOrder));
}
if (this.dateSortOrder !== SortOrder.NONE) {
return this.filteredTransactions.slice().sort(Sorts.date((tx: TxDatum) => tx.date, this.dateSortOrder));
}
if (this.pfSortOrder !== SortOrder.NONE) {
return this.filteredTransactions.slice().sort(Sorts.text((tx: TxDatum) => tx.wallet, this.pfSortOrder));
}
return this.filteredTransactions;
} |
works good on v3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The @Tracked array used as items do not rerender on update
The text was updated successfully, but these errors were encountered: