Skip to content
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

Inferno loses force param when forceUpdate is called inside the updating cycle or there are any pending updates in QUEUE #1534

Closed
xnimorz opened this issue Feb 7, 2021 · 1 comment
Labels

Comments

@xnimorz
Copy link
Contributor

xnimorz commented Feb 7, 2021

Observed Behaviour

Inferno loses force param when forceUpdate is called inside the updating cycle (when renderCheck.v is set to true) or there are any components in QUEUE
https://github.com/infernojs/inferno/blob/master/packages/inferno/src/core/component.ts#L31-L40

So it means that shouldComponentUpdate for the component will be executed if forceUpdate is called in componentDidUpdate func or when there are any components get into QUEUE list. At the time if we wrap forceUpadate call inside setTimeout everything would be okay (so SCU won't be called).

It leads to unpredictable behavior, as the method works differently in different situations.

Repro

A simple example with PureComponent and render prop:
Repo: https://github.com/xnimorz/inferno-exp
Code sandbox: https://codesandbox.io/s/quirky-lake-erclr (try to click different buttons. The first button doesn't work as it was designed)

If needed I can extend the example.

Also, the original issue I got when I tried to call recomputeGridSize for my lists using https://github.com/bvaughn/react-virtualized

Expected Current Behaviour

Inferno should remember about force param so that components can be updated in a proper way.

@Havunen
Copy link
Member

Havunen commented Feb 14, 2021

@Havunen Havunen closed this as completed Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants