GithubHelp home page GithubHelp logo

Comments (3)

ravicious avatar ravicious commented on May 26, 2024 1

Launching a deep link waits until the frontend app is ready:

async launchDeepLink(
deepLinkParseResult: DeepLinkParseResult
): Promise<void> {
try {
await this.whenFrontendAppIsReady();

Currently the readiness is signaled after WorkspacesService.prototype.restorePersistedState resolves, which includes a call to restore the previous workspace. This is what triggers the login modal for the previous cluster and waits until that modal is closed.

await showStartupModalsAndNotifications(appContext);
appContext.mainProcessClient.signalUserInterfaceReadiness({
success: true,
});

/**
* Runs after the UI becomes visible.
*/
export async function showStartupModalsAndNotifications(
ctx: IAppContext
): Promise<void> {
const { configService } = ctx.mainProcessClient;
await askAboutUserJobRoleIfNeeded(
ctx.statePersistenceService,
configService,
ctx.modalsService,
ctx.usageService
);
// Setting up usage reporting after asking for a job role prevents a situation
// where these dialogs are shown one after another.
// Instead, on the first launch only "usage reporting" dialog shows up.
// "User job role" dialog is shown on the second launch (only if user agreed to reporting earlier).
await setUpUsageReporting(configService, ctx.modalsService);
// If there's a workspace that was active before the user closed the app, restorePersistedState
// will block until the user interacts with the login modal (if the cert is not valid anymore) and
// the modal for restoring documents.
await ctx.workspacesService.restorePersistedState();

The solution would be to:

  1. Move this.setActiveWorkspace out of WorkspacesService.prototype.restorePersistedState into showStartupModalsAndNotifications. (restorePersistedState is called only once in the app).
  2. Signal readiness after restorePersistedState but before setActiveWorkspace.
    • Similarly, isInitialized of WorkspacesService should be set to true after restorePersistedState but before setActiveWorkspace. This affects VNet only though, not deep links.
  3. Make setActiveWorkspace accept a signal.
  4. WindowsManagerIpc.SignalUserInterfaceReadiness should return an AbortController that aborts the signal passed to setActiveWorkspace in showStartupModalsAndNotifications.
  5. WindowsManager.prototype.launchDeepLink should pass the abort controller to DeepLinksService.prototype.launchDeepLink in the render process.
    • So far, each deep link handler already sets the correct workspace by calling loginAndSetActiveWorkspace. That method should abort the abort controller and show the modal for the right workspace. We cannot always abort the controller, because in the future there might be deep links that are not related to a particular workspace.

Instead of passing an abort controller back and forth between processes through WindowsManagerIpc.SignalUserInterfaceReadiness, perhaps we can create a single abort controller in AppContext (called, idk, restoreWorkspaceAbortController) and then pass it to both DeepLinksService and showStartupModalsAndNotifications.

from teleport.

codingllama avatar codingllama commented on May 26, 2024

As @avatus put it, in much fewer words:

  1. Connect opens and tries to open any sessions
  2. Sees the expired session and tries to reauth
  3. Now that its done "starting", it opens the deep link

from teleport.

codingllama avatar codingllama commented on May 26, 2024

It's probably the same, but we should also consider what happens with distinct users for the same cluster.

from teleport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.