update
This commit is contained in:
parent
fcf4ced282
commit
178a329e45
|
|
@ -95,17 +95,15 @@ export class TldrawDurableObject {
|
||||||
this.roomPromise = (async () => {
|
this.roomPromise = (async () => {
|
||||||
// fetch the room from R2
|
// fetch the room from R2
|
||||||
const roomFromBucket = await this.r2.get(`rooms/${roomId}`)
|
const roomFromBucket = await this.r2.get(`rooms/${roomId}`)
|
||||||
|
console.log("we are in a room")
|
||||||
// if it doesn't exist, we'll just create a new empty room
|
// if it doesn't exist, we'll just create a new empty room
|
||||||
const initialSnapshot = roomFromBucket
|
const initialSnapshot = roomFromBucket
|
||||||
? ((await roomFromBucket.json()) as RoomSnapshot)
|
? ((await roomFromBucket.json()) as RoomSnapshot)
|
||||||
: undefined
|
: undefined
|
||||||
if (initialSnapshot) {
|
if (initialSnapshot) {
|
||||||
for (const record of initialSnapshot?.documents) {
|
initialSnapshot?.documents.slice(0, 10).forEach(record => {
|
||||||
if (record.state.typeName === "chatBox") {
|
console.log("record", record)
|
||||||
console.log("chatbox", record)
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// create a new TLSocketRoom. This handles all the sync protocol & websocket connections.
|
// create a new TLSocketRoom. This handles all the sync protocol & websocket connections.
|
||||||
// it's up to us to persist the room state to R2 when needed though.
|
// it's up to us to persist the room state to R2 when needed though.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue