async provide in plugin #11141
Unanswered
idc77
asked this question in
Help/Questions
Replies: 1 comment
-
You call One way to handle this could be to provide an empty install: (app, options) => {
const dbRef = ref()
app.provide(SurrealClientSymbol, dbRef)
const db = new Surreal();
db.connect(/* ... */).then(()=> {
dbRef.value = db
})
} const db = inject(SurrealClientSymbol) // a ref, initially empty
const blogs = ref()
watch(db, () => {
if (db.value) {
blogs.value = db.select("blog")
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to provide a const but I'm getting errors
Beta Was this translation helpful? Give feedback.
All reactions