You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feel free to leave comments about the future of the 0.5.0 release, which is currently in alpha and based on the offical SDK v2, which is also in alpha.
you can find some of my notes in various merged PRs
With release 0.5.0-alpha.4 I've refactored the SSR-safe composables and introduced a new one called useSurrealAsyncData (which is used under the hood by all other SSR-safe composables)
As of now it requires the first argument to be a string which will be used by useAsyndData as its unique hydration key, while the second argument is a callback which exposes the underlying configured Surreal client. Please also make sure to always call .json() when returning data from the client, as currently I cannot correctly serialize automatically the incoming data before sending for hydration.
In the following example we can see that it supports reactive data
consttableRef=ref('test')constidRef=ref('fbvohpnfii61m24uizw1')const{ data }=awaituseSurrealAsyncData('select:test',(client)=>{returnclient.select(newRecordId(tableRef.value,idRef.value)).where(eq('payload','ciao')).json()},{watch: [tableRef,idRef],})
Caveats
Currently useSurrealSelect cannot accept a reactive Table, RecordId or RecordIdRange. If you do need them to be reactive plese use useSurrealAsyncData shown above. Otherwise, if you do need reactive data in the where statement or similar it works as normal:
constwhereRef=ref('ciao')const{ data }=awaituseSurrealSelect(newTable('test'),(select)=>{returnselect.where(eq('payload',whereRef.value))},{watch: [whereRef],})
I've been using the alpha and beta for a few months now, mostly for performance and size optimization, along some other changes like the ability to alter tables and fields, or about data types. This major has so many changes done in so much time. What I'm really interested in is surqlize, which really looks promising
@Deeyuudesurrealdb/surrealdb.js#507 got merged. I'll make sure to update this project in a few days as I'm able to work on it and publish a new release!
Thank you for your amazing work :) Really solid ! One question if you don't mind isn't SurrealKV will replace IndexedDB ? I've seen it somewhere they said that SurrealKV was made for replacing rocksDB for sure but i think it's the case for IndexedDB too if i'm not wrong
They are planning to use OPFS with SurrealKV instead of IndexedDB, but as of now this is planned as an opt-in feature, which to my testing neither work yet with Surreal 3.0, we'll have to wait.
Tho better-auth doesn't play really well with useRuntimeConfig (called inside useSurreal), as it would lack all the Nitro context in general. But this only applies if you are trying to run their cli to generated the schema automatically (wichu you would either need to gernerate manually or create a dedicated useSurreal mock, something quite a bit more advanced...).
Tho I wouldn't personally use better-auth with surreal, as it already offers solid auth via their methods, tho it has a steeper learning curve compared to better-auth
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Feel free to leave comments about the future of the
0.5.0release, which is currently inalphaand based on the offical SDK v2, which is also in alpha.you can find some of my notes in various merged PRs
All reactions