FlexLayout icon indicating copy to clipboard operation
FlexLayout copied to clipboard

SelectTab does not select tab if multiple tabs are invoked

Open rohitisinhk opened this issue 3 years ago • 1 comments

Describe the bug

In my react app - I have some tabs that are not selected at start, and therefore the underlying components are not initialized. When the app starts i'd like to select each tab so the underlying component could be initialized.

useEffect(()=> { model.doAction(Actions.selectTab("tabid1")); model.doAction(Actions.selectTab("tabid2")); model.doAction(Actions.selectTab("tabid3")); }, []);

However with above snippet i see only tabid3 gets initialized, tabid1 and tabid2 are dud and do not get initialized

However if i invoke like so

useEffect(() => { let timeout = setTimeout(()=>{ model.doAction(Actions.selectTab("tabid1")); model.doAction(Actions.selectTab("tabid2")); model.doAction(Actions.selectTab("tabid3")); }, 1000), return () => { clearTimeout(timeout) } }

It all works, can someone please explain this behavior and if you can correct me if there is a better way to initialize?

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Please see main explanation

Expected behavior

Please see main explanation

Operating System

Windows

Browser Type?

Chrome

Browser Version

Latest

Screenshots or Videos

None

Additional context

No response

rohitisinhk avatar Mar 07 '22 11:03 rohitisinhk

try setting the global attribute tabEnableRenderOnDemand: false

"global": {
        "tabEnableRenderOnDemand": false
},

nealus avatar Mar 07 '22 11:03 nealus