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

TypeError: Cannot read properties of undefined (reading '_x_refs') #6

Open
bubnenkoff opened this issue Jan 25, 2022 · 1 comment
Open

Comments

@bubnenkoff
Copy link

Hi! I tried copy-past your code example (only changed name of component) in my project to be sure that I am doing all right. But got an error:
Component:

<template id="regions-component">
 <script>
     const privateVar = "I'll never tell."

     export let killCount = 0

     export function shoot(){
         let success = Math.round(Math.random())
         this.killCount += success
         xref('result').innerText = success ? 'Hit!' : 'Miss'
         xref('count').innerText = this.killCount
     }
 </script>
 
 <button onclick="this.props.shoot()">Shoot</button>
 <p x-ref="result"></p>
 <p>Kill Count: <span x-ref="count"></span></p>
</template>

Error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '_x_refs')
    at Function.Qr.inline (cdn.min.js:5:31873)
    at u (cdn.min.js:5:1964)
    at cdn.min.js:5:4391
    at Array.forEach (<anonymous>)
    at cdn.min.js:5:4380
    at D (cdn.min.js:5:3323)
    at cdn.min.js:5:3296
    at Array.forEach (<anonymous>)
    at D (cdn.min.js:5:3285)
    at cdn.min.js:5:4349

изображение

@Lomacar
Copy link
Owner

Lomacar commented Jan 26, 2022

Hmm, I believe I still needed to do some work with x-ref, but it is working fine for me: https://codepen.io/lomacar/pen/RwLXbNq.

How are you loading Ewok and Alpine?

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

2 participants