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

getBundle$ can hang for a long time giving the impression that alignment has failed #122

Closed
dhdaines opened this issue Feb 17, 2023 · 6 comments

Comments

@dhdaines
Copy link
Collaborator

When you click on "Go to the next step!", one of the things that happens is this:

  getBundle$(): Observable<any[]> {
    return forkJoin([
      this.http
        .get(this.JS_BUNDLE_URL, { responseType: "blob" })
        .pipe(
          switchMap((blob: Blob) => this.fileService.readFileAsData$(blob))
        ),
      this.http
        .get(this.FONTS_BUNDLE_URL, { responseType: "blob" })
        .pipe(
          switchMap((blob: Blob) => this.fileService.readFileAsData$(blob))
        ),
    ]);
  }

As we have established elsewhere (ReadAlongs/Studio#155) unpkg can be very quite slow. This mistakenly gives the impression that alignment has failed, when in fact we are just waiting to download our own code through an elaborate Internet Rube Goldberg machine.

It would be good to find a way to construct the bundle from our own copies of these things (realizing that this may be more difficult than it sounds) to avoid this problem

@dhdaines
Copy link
Collaborator Author

dhdaines commented Feb 17, 2023

Alternately, since it's really the version resolution that is slow, if we can retrieve the exact version number that we used to build studio-web and then use that, this would be a vast improvement, since we wouldn't be hardcoding the versoin in our code anymore.

@joanise
Copy link
Member

joanise commented Feb 17, 2023

We should consider using the version in package.json explicitly, maybe via a method like this:
https://stackoverflow.com/questions/34907682/how-to-display-the-app-version-in-angular

Caveat: there's a bit of a chicken and egg problem: when we bump the version but haven't published it yet, how can getBundle$() work? We'll need to think about that.

In any case, using 0.2.1 instead of ^0.2.1, as dhdaines says, would be a lot faster, so we should think about whether we really need to use the ^ or if we should maybe resort to the fixed version instead. If the version was tied to the build we're using, that would always be up to date, especially if it was controlled from package.json in the first place.

I understand the value of using ^ for multi-file RAs, but for single-file RAs it won't make a difference since we bundle it all.

@roedoejet
Copy link
Collaborator

why don't we just retrieve the bundle used when building studio-web. we can include it as an asset in the build? and then we just avoid unpkg altogether for our site.

@joanise
Copy link
Member

joanise commented Feb 17, 2023

Yeah, totally! Great idea.

@roedoejet
Copy link
Collaborator

ok I"ll do this

@dhdaines
Copy link
Collaborator Author

thanks Aidan! fixed in #123

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

3 participants