yysun/apprun

Doubling components on the screen

svkior opened this issue · 5 comments

I've written example to reproduce the bug.

https://github.com/svkior/apprunissue1

How to reproduce

I have two components which receives data from backend (I simulate this with setInterval functions). When I trigger app.run by clicking on the button, second component is rendered instead of first one.

Expected

Do nothing.

yysun commented

If you don't want the component to render, you should return nothing. E.g., instead of

const update = {
  "do_nothing": (state) => ({
    ...state, // DO NOTHING!!!!
  }),
}

do not return the state

const update = {
  "do_nothing": (state) => {
  // update date quietly
  },
}

I Please forgive me, I probably didn’t explain it correctly. I reduced my current project to a minimum in order to demonstrate the problem.

The problem was that with any change in state in the browser, the second component is doubled and overwrites the first component. If I use a function instead of components, then everything will be correct.

yysun commented

I see. I will look into it.

yysun commented

The workaround is to add id for the components.

 <BottomPanel id="bottomPanel"/>

upgrade to 2.23.16 helped. Thank You