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

[✨] Partial URL matching in "loadScriptsOnMainThread" #477

Closed
BonoBelarus opened this issue Oct 6, 2023 · 1 comment
Closed

[✨] Partial URL matching in "loadScriptsOnMainThread" #477

BonoBelarus opened this issue Oct 6, 2023 · 1 comment
Labels
enhancement New feature or request stale

Comments

@BonoBelarus
Copy link

BonoBelarus commented Oct 6, 2023

Is your feature request related to a problem?

Currently, the "loadScriptsOnMainThread" option uses strict string equality to determine if a script should be executed on the main thread. However, this approach is not flexible when URLs contain query parameters.

Describe the solution you'd like

I suggest changing this behavior to partial string matching or allowing the use of regular expressions to match URLs.
Something like this

// index.html
window.partytown = {
  ...
  loadScriptsOnMainThread: ["https://googleads.g.doubleclick.net/pagead/viewthroughconversion/"],
}

// partytown-ww-sw.js
// url may be like: "https://googleads.g.doubleclick.net/pagead/viewthroughconversion/123123123/?random=123123&cv=12&fst=1232123&bg=ffffff&guid=ON&..."
const shouldExecuteScriptViaMainThread = config.loadScriptsOnMainThread.some(
  scriptUrl => decodeURIComponent(url).includes(scriptUrl),
)

Describe alternatives you've considered

Additional context

No response

Copy link
Contributor

Partytown moves to QwikDev organization, this is a new beginning for the project. So it's time to clarify the status and clean up the current state a bit. This issue was automatically marked as deprecated and closed because it was not detected recent activity for 8 months, date of latest version. If this issue is still relevant, feel free to comment below and the maintainers will reopen it. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 24, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

1 participant