ntohq / buefy-next

Lightweight UI components for Vue.js (Vue3) based on Bulma
https://v3.buefy.org
MIT License
120 stars 10 forks source link

Infinite Table updates? #191

Open kikuomax opened 9 months ago

kikuomax commented 9 months ago

Overview of the problem

Buefy version: [0.1.2] Vuejs version: [3.3.7] OS/Browser: macOS/test-utils

Description

Table caused infinite updates of reactive states.

[Vue warn]: Maximum recursive updates exceeded in component <BTable>. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.

Steps to reproduce

  1. Merge changes in the original buefy repo (#159)
  2. cd packages/buefy-next
  3. npx jest src/components/table/TableColumn.spec.js

Expected behavior

No infinite updates.

Actual behavior

Infinite updates.

kikuomax commented 2 months ago

This might be caused by values bound to <b-slot-component>, which are return values of methods; i.e., a brand new object is created every time the method is called. https://github.com/ntohq/buefy-next/blob/185589fbced9100d05c84760a7e4eed6dee53da7/packages/buefy-next/src/components/table/Table.vue#L318-L332

I found a case where the recursion error disappeared if I removed all of the v-bind, :class, and :style bindings.

wesdevpro commented 2 months ago

This might be caused by values bound to <b-slot-component>, which are return values of methods; i.e., a brand new object is created every time the method is called. https://github.com/ntohq/buefy-next/blob/185589fbced9100d05c84760a7e4eed6dee53da7/packages/buefy-next/src/components/table/Table.vue#L318-L332

I found a case where the recursion error disappeared if I removed all of the v-bind, :class, and :style bindings.

As a result did the CPU usage go down to?

kikuomax commented 2 months ago

As a result did the CPU usage go down to?

@wesdevpro I was not able to measure the CPU usage because I just ran a tiny Vitest test case.

wesdevpro commented 2 months ago

As a result did the CPU usage go down to?

@wesdevpro I was not able to measure the CPU usage because I just ran a tiny Vitest test case.

That makes sense