You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: