Problem
useTable holds editing state as React-controlled state, so immediately after setPendingValue/fillRange — including inside a state:change event handler — table.getState().editing.pendingValues and hasPendingChanges() return the previous (often empty) snapshot. Calling commitAllPending() from the event handler therefore silently commits nothing. The values only become readable one render later.
Repro
table.on('state:change', () => {
console.log(table.getState().editing.pendingValues) // {} right after fillRange
table.commitAllPending() // no-op
})
Workaround
Bump a counter in the handler and run commitAllPending() in a useEffect keyed on it (post-flush).
Suggested fix
Have the imperative API read from a ref that's updated synchronously, or document that state reads inside event handlers are pre-flush and the effect-deferral pattern is required.
Versions: yable-react 0.10.4 / yable-core 0.9.0.
Problem
useTableholds editing state as React-controlled state, so immediately aftersetPendingValue/fillRange— including inside astate:changeevent handler —table.getState().editing.pendingValuesandhasPendingChanges()return the previous (often empty) snapshot. CallingcommitAllPending()from the event handler therefore silently commits nothing. The values only become readable one render later.Repro
Workaround
Bump a counter in the handler and run
commitAllPending()in auseEffectkeyed on it (post-flush).Suggested fix
Have the imperative API read from a ref that's updated synchronously, or document that state reads inside event handlers are pre-flush and the effect-deferral pattern is required.
Versions: yable-react 0.10.4 / yable-core 0.9.0.