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

useScriptTag broken when src is ref #2026

Closed
7 tasks done
shtse8 opened this issue Aug 1, 2022 · 0 comments · Fixed by #2030
Closed
7 tasks done

useScriptTag broken when src is ref #2026

shtse8 opened this issue Aug 1, 2022 · 0 comments · Fixed by #2030

Comments

@shtse8
Copy link

shtse8 commented Aug 1, 2022

Describe the bug

let el = document.querySelector<HTMLScriptElement>(`script[src="${src}"]`)

src here missing resolveUnref

const { scriptTag } = useScriptTag(computed(() => `https://connect.facebook.net/${locale.value?.code ?? 'en_US'}/sdk.js`), () => {
  FB.init({
    appId: '12345678901234567890',
    autoLogAppEvents: true,
    xfbml: false,
    version: 'v14.0',
  })
}, {
  async: true,
  defer: true,
  // manual: true,
})

error:

Uncaught (in promise) DOMException: Failed to execute 'querySelector' on 'Document': 'script[src="() => "https://connect.facebook.net/zh_TW/sdk.js""]' is not a valid selector.

Reproduction

as above.

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04 LTS 22.04 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Xeon(R) CPU @ 2.20GHz
    Memory: 1.58 GB / 3.83 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.7.0/bin/yarn
    npm: 8.15.1 - ~/.nvm/versions/node/v18.7.0/bin/npm
  Browsers:
    Firefox: 103.0
  npmPackages:
    @vueuse/components: ^9.0.2 => 9.0.2
    @vueuse/core: ^9.0.2 => 9.0.2
    @vueuse/motion: ^2.0.0-beta.12 => 2.0.0-beta.12
    @vueuse/nuxt: ^9.0.2 => 9.0.2

Used Package Manager

yarn

Validations

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

Successfully merging a pull request may close this issue.

1 participant