Hi, If a user only has access to one workspace, n...
# gooddata-ui
m
Hi, If a user only has access to one workspace, not dev or value in constants.js. What’s the best way to set his workspace when the app loads? At the moment, I do a useEffect like this: useEffect(() => { if (!workspaceList.isLoading && workspaceList.firstWorkspace) { setWorkspace(workspaceList.firstWorkspace); } }, [workspaceList]);
j
Did you use the create-gooddata-react-app boilerplate to start your GoodData.UI application? If so there should already be some logic in
src/contexts/WorkspaceList.js
and
src/contexts/Workspace.js
. Are you using the
WorkspaceProvider
from
@gooddata/sdk-ui
? The snippet you shared looks good to me.