Hi, In my Angular 20 app, I’ve implemented a layou...
# gooddata-cloud
v
Hi, In my Angular 20 app, I’ve implemented a layout that displays the selected dashboard from the navigation bar. However, when I switch between dashboards that belong to different workspaces, I get 404 error on the screen and the following message in the browser console: Context is already set It seems that I need to re-set the context somehow, but I’m not sure what’s the proper way to do it. It's Web Component implementation and everything else works just fine. In my Angular component, I currently load the workspace scripts like this:
Copy code
private async loadScriptAsModule(url: string, id: string): Promise<any> {
  return new Promise((resolve, reject) => {
    const script = document.createElement('script');
    script.type = 'module';
    script.src = url;
    script.id = id;

    script.onload = async () => {
      try {
        const module = await window.eval(`import('${url}')`);
        resolve(module);
      } catch (err) {
        reject(err);
      }
    };

    script.onerror = reject;
    document.head.appendChild(script);
  });
}
Authentication setup:
Copy code
private setupGDBackend() {
  if(!this.gdBackend) {
    console.log("setting up tiger backend");
    this.gdBackend = tigerFactory()
      .onHostname(this.apiService.getGoodDataBaseUrl())
      .withAuthentication(
        new TigerJwtAuthProvider(this.token,
          this.notAuthHandler,
          this.jwtIsAboutToExpiryHandler,
          10)
      );
  }
}
That's how I set the context:
Copy code
this.workspaceModule.setContext({
  backend: this.gdBackend,
  workspaceId: workspaceId,
});
I tried to remove the loaded workspace A script and load the proper workspace B script and set the context again, but it hasn't helped. Could you please advise how to correctly re-initialize or reset the context when switching workspaces? Thank you!
k
New message text here