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

SelectTab does not select tab if multiple tabs are invoked #307

Open
rohitisinhk opened this issue Mar 7, 2022 · 1 comment
Open

SelectTab does not select tab if multiple tabs are invoked #307

rohitisinhk opened this issue Mar 7, 2022 · 1 comment

Comments

@rohitisinhk
Copy link

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

@nealus
Copy link
Collaborator

nealus commented Mar 7, 2022

try setting the global attribute tabEnableRenderOnDemand: false

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants