Hi all, I've implemented Gooddata web component i...
# gd-beginners
s
Hi all, I've implemented Gooddata web component in angular, I'm trying to display multiple dashboard in a list and I'm using token based authentication which sets the auth context like below
Copy code
setContext({
					backend: factory()
						.onHostname("<https://abc.cloud.gooddata.com>")
						.withAuthentication(new TigerTokenAuthProvider(token)),
					workspaceId,
				});
now what I'm trying to do is change the workspace id and reset the context, but it's saying
Context is already set
my question is, is there a way to clear previous context without reloading the page ? Appreciate any help
r
Hey there Shahenshah, Radek from the GoodData Technical team here! Just to confirm, the intended use-case here is to display multiple different dashboards from different workspaces to a user? I suspect that may not be possible to do seamlessly without a page reload, but I want to make sure we're on the same page before digging deeper 🙂
s
Yes, exactly that's what I was hoping to do
👀 1
@Radek Novacek Turns out even when I reload "programmatically" the context isn't getting reset, it happens when I manually reload the page from browser but doesn't when I do
location.reload()
or `window.location.href=`path`` Let me know if there's any other way, I've tried everything I could think of
r
Yeah, I've run into the same when testing on my side, I'll try and discuss with the devs if there are any alternatives they can think of maybe
The one thing that I'm wondering - what happens if you don't explicitly set the workspaceId? It does seem to be optional in the code:
Copy code
export type CustomElementContext = {
    backend: IAnalyticalBackend;
    workspaceId?: string;
    mapboxToken?: string;
};
(https://github.com/gooddata/gooddata-ui-sdk/blob/32c38de65a1572c029244e2431e0c5c8396467bb/libs/sdk-ui-web-components/src/context.ts#L45)
s
I tried and got
Copy code
CustomElementAdapter.ts:50 Failed to load dependencies for the visualization Invariant Violation: Workspace must be provided either through script URL or directly in HTML.
r
Alright, so the devs came back with an option for this - if you'd like to use different workspaceIds for different instances of the components, you can override the default value through attributes - more info on that here! That should be a little more effective than trying to flush the context entirely 🙂
s
Thank you, i’ll look into it and will update
🤞 1
Hi @Radek Novacek how are you doing, The last solution I discussed with you guys was working absolutely fine till today, today we started getting this console error randomly, our GD dashboard in production is also affected and users are getting a blank page, people who have gooddata cloud access are seeing infinite loading, is there an outage
r
Hi @Shahenshah Malik, we have unfortunately been experiencing some issues - it has been announced on our Support page, and the same page will receive updates when we know more. Please accept my apologies for any inconvenience!
s
No problem, thanks.
Hey Radek, sorry to bother you again but the GoodData cloud is back up and running but our dashboard isn't. we're specifically using this implementation right now because of our very specific requirements
Copy code
// Create the script content with imports and context setup
				script.textContent = `
					import { setContext } from "<https://someDomain.cloud.gooddata.com/components/${workspaceId}.js>";
					import factory, { TigerTokenAuthProvider } from "<https://someDomain.cloud.gooddata.com/components/tigerBackend.js>";

					try {
						setContext({
						backend: factory()
							.onHostname("<https://innerspace.cloud.gooddata.com>")
							.withAuthentication(new TigerTokenAuthProvider("${token}")),
						workspaceId: "${workspaceId}",
					});
					} catch(e) {
						// console.log('Context set');
					}
				`;
s
@Radek Novacek any help here is greatly appreciated as our embedded dashboards are still unavailable.