algolia / algolia/doc-code-samples

Cannot read property 'instantSearchInstance' of undefined

Đang mở
#249 11 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
99
Fork
122
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I followed the intruction like this package project. i am using vue-instantsearch 4.0.0 for vuejs 3

I copied script like below:

```

import algoliasearch from 'algoliasearch/lite'
import { h, onMounted, Fragment, render, ref } from 'vue'
import { useRouter } from 'vue-router'
import { createElement } from '../composables/adapter'

export default {

data(){
return {
searchClient: algoliasearch(
"latency",
"6be0576ff61c053d5f9a3225e2a90f76"
),
}
},
setup(){

onMounted(() => {
})

return {

}
}

}

.container {
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
}
.search-panel {
display: flex;
}
.search-panel__filters {
flex: 1;
}
.search-panel__results {
flex: 3;
}
.searchbox {
margin-bottom: 2rem;
}
.pagination {
margin: 2rem auto;
text-align: center;
}

```
But the result is error in console.

> Uncaught (in promise) TypeError: Cannot read property 'instantSearchInstance' of undefined
> at Proxy.eval (widget.js?c00b:1)
> at Proxy.created (widget.js?c00b:1)
> at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:154)
> at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?5c40:163)
> at callHookFromMixins (runtime-core.esm-bundler.js?5c40:5914)
> at callSyncHook (runtime-core.esm-bundler.js?5c40:5890)
> at applyOptions (runtime-core.esm-bundler.js?5c40:5825)
> at finishComponentSetup (runtime-core.esm-bundler.js?5c40:6503)
> at setupStatefulComponent (runtime-core.esm-bundler.js?5c40:6436)
> at setupComponent (runtime-core.esm-bundler.js?5c40:6376)
> eval @ widget.js?c00b:1
> created @ widget.js?c00b:1

Btw, i have same settings in main.js
```
import InstantSearch from 'vue-instantsearch/vue3/es'
import { projectAuth } from './firebase/config'

let app

projectAuth.onAuthStateChanged(() => {
if(!app){
app = createApp(App)
.use(router)
.use(store)
.use(Notifications)
.use(InstantSearch)
.mount('#app')
}
})
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu với component được hiển thị trong issue và so sánh cách sử dụng Vue InstantSearch của component đó với việc đăng ký plugin trong main.js. Tái hiện lỗi Vue 3 bằng vue-instantsearch 4.0.0, sau đó lần theo quyền truy cập được báo cáo đến instantSearchInstance. Hoàn thành khi ví dụ được cung cấp mount mà không có lỗi console được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
32/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.