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

Fix issues with missing sourcemaps #6572

Merged
merged 5 commits into from
May 10, 2023
Merged

Conversation

somebody1234
Copy link
Contributor

Pull Request Description

Fixes #6559:

DevTools failed to load source map: Could not load content for http://localhost:8080/preload.cjs.map: Load canceled due to load timeout
DevTools failed to load source map: Could not load content for http://localhost:8080/pkg.js.map: Load canceled due to load timeout

Important Notes

None

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@somebody1234 somebody1234 added the CI: No changelog needed Do not require a changelog entry for this PR. label May 5, 2023
@somebody1234 somebody1234 force-pushed the wip/sb/ship-source-maps branch from 7459599 to 639cb7f Compare May 5, 2023 09:11
@somebody1234
Copy link
Contributor Author

oh @mwu-tow you might want to check that this fixes the issue.
note that the current fix for preload.cjs puts the sourcemap inline inside the js file, which will probably slow down startup, but hopefully shouldn't be noticeable

@mwu-tow
Copy link
Contributor

mwu-tow commented May 5, 2023

@somebody1234
Why the preload map needs to be inline, while we can ship pkg.js.map?

We've been really very aggressively trying to keep the size down, so increasing the core download size might be somewhat iffy.

@somebody1234
Copy link
Contributor Author

@mwu-tow we don't serve preload.cjs - in fact i can't even see it in devtools. i can do some further research into whether we can get it working, but note that preload.cjs.map does exist beside preload.cjs, but for some reason it's trying to fetch /preload.cjs.map when preload.cjs isn't even served by the server

@somebody1234
Copy link
Contributor Author

alternatively i can just take the preload.cjs stuff out of this PR and create a new one if i find a better solution

@mwu-tow
Copy link
Contributor

mwu-tow commented May 5, 2023

@somebody1234

we don't serve preload.cjs - in fact i can't even see it in devtools. i can do some further research into whether we can get it working, but note that preload.cjs.map does exist beside preload.cjs, but for some reason it's trying to fetch /preload.cjs.map when preload.cjs isn't even served by the server

The preload script is loaded by the Electron before loading the actual site, it is shipped and served. I think it does not show up because the server does not serve files from the root of the resources but only from the assets subdirectory.

See the resources in the Electron bundle:
obraz

Comment on lines 27 to 31
/** Construct a URL query string with the given parameters. For each `key` - `value` pair,
* `key=value` will be added to the query. */
export function urlParamsFromObject(obj: Record<string, string>) {
const params = []
for (const [key, value] of Object.entries(obj)) {
params.push(`${key}=${encodeURIComponent(value)}`)
}
return params.length === 0 ? '' : '?' + params.join('&')
const params = new URLSearchParams(obj).toString()
return params ? '?' + params : ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really neat change, yet at the same time, it got me thinking, about whether we need this function at all. It being string-ly typed is a code smell to me.
Perhaps we can construct URL by using the URL API rather than by pretty-printing pieces of text together.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately it seems even the url api requires properties to be strings... but i think it might be a good idea to completely remove urlParamsFromObject anyway as the URL APIs can do the same thing?

@@ -110,7 +109,10 @@ export class Server {
} else {
const url = requestUrl.split('?')[0]
const resource = url === '/' ? '/index.html' : requestUrl
const resourceFile = `${this.config.dir}${resource}`
const resourceFile =
resource === '/preload.cjs.map'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment on why this single file needs special treatment here.

@mwu-tow
Copy link
Contributor

mwu-tow commented May 9, 2023

🟢 Did QA, the issue is fixed. Thanks for taking care of it!

@PabloBuchu PabloBuchu merged commit 0d9186b into develop May 10, 2023
@PabloBuchu PabloBuchu deleted the wip/sb/ship-source-maps branch May 10, 2023 09:03
Procrat added a commit that referenced this pull request May 10, 2023
…ing-6287

* develop:
  Fix issues with missing sourcemaps (#6572)
  Fix asset delete; implement project delete and project rename (#6566)
  Fix #6377: Change ctrl-r shortcut (#6620)
  Add tests for Date.until, Date.next and Date.previous. (#6606)
  Improve `Non_Unique_Primary_Key` error, split file format detection into read/write, improve SQLite format detection (#6604)
  tokenize_to_columns or parse_to_columns results in a single column we shouldn't add the  1 (#6607)
  Fix node editing race condition (#6594)
  Add format to the in-memory Column (#6538)
  Fix dashboard issues (part 2) (#6511)
  Fix visualisation type selector artifacts rendered after node preview visualisation was closed. (#6575)
  Revert typescript CI Lint changes (#6602)
  Fix the Engine version check in GUI (#6570)
Procrat added a commit that referenced this pull request May 10, 2023
* develop:
  Limit the number of reported warnings (#6577)
  Add COOP+COEP+CORP headers (#6597)
  Fix issues with missing sourcemaps (#6572)
  Fix asset delete; implement project delete and project rename (#6566)
  Fix #6377: Change ctrl-r shortcut (#6620)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source Map Loading Timeout Warnings in Console When Creating a New Project
3 participants