fix cloudflare
This commit is contained in:
parent
664d0ca9c5
commit
face742eef
|
|
@ -1,7 +1,7 @@
|
||||||
import { useAutomergeSync } from "@/automerge/useAutomergeSync"
|
import { useAutomergeSync } from "@/automerge/useAutomergeSync"
|
||||||
import { AutomergeHandleProvider } from "@/context/AutomergeHandleContext"
|
import { AutomergeHandleProvider } from "@/context/AutomergeHandleContext"
|
||||||
import { useMemo, useEffect, useState, useRef } from "react"
|
import { useMemo, useEffect, useState, useRef } from "react"
|
||||||
import { Tldraw, Editor, TLShapeId } from "tldraw"
|
import { Tldraw, Editor, TLShapeId, TLRecord } from "tldraw"
|
||||||
import { useParams } from "react-router-dom"
|
import { useParams } from "react-router-dom"
|
||||||
import { ChatBoxTool } from "@/tools/ChatBoxTool"
|
import { ChatBoxTool } from "@/tools/ChatBoxTool"
|
||||||
import { ChatBoxShape } from "@/shapes/ChatBoxShapeUtil"
|
import { ChatBoxShape } from "@/shapes/ChatBoxShapeUtil"
|
||||||
|
|
@ -308,18 +308,21 @@ export function Board() {
|
||||||
console.log(`📊 Board: Attempting to refresh store to make shapes visible`)
|
console.log(`📊 Board: Attempting to refresh store to make shapes visible`)
|
||||||
try {
|
try {
|
||||||
// Force a store update by reading and re-putting the shapes
|
// Force a store update by reading and re-putting the shapes
|
||||||
|
if (!store.store) return
|
||||||
|
|
||||||
|
const currentStore = store.store
|
||||||
const shapesToRefresh = missingShapes.slice(0, 10) // Limit to first 10 to avoid performance issues
|
const shapesToRefresh = missingShapes.slice(0, 10) // Limit to first 10 to avoid performance issues
|
||||||
const refreshedShapes = shapesToRefresh.map((s: any) => {
|
const refreshedShapes = shapesToRefresh.map((s: any) => {
|
||||||
const shapeFromStore = store.store.get(s.id)
|
const shapeFromStore = currentStore.get(s.id)
|
||||||
if (shapeFromStore) {
|
if (shapeFromStore) {
|
||||||
return shapeFromStore
|
return shapeFromStore
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}).filter((s): s is NonNullable<typeof s> => s !== null)
|
}).filter((s): s is TLRecord => s !== null)
|
||||||
|
|
||||||
if (refreshedShapes.length > 0) {
|
if (refreshedShapes.length > 0) {
|
||||||
console.log(`📊 Board: Refreshing ${refreshedShapes.length} shapes in store`)
|
console.log(`📊 Board: Refreshing ${refreshedShapes.length} shapes in store`)
|
||||||
store.store.put(refreshedShapes)
|
currentStore.put(refreshedShapes)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`📊 Board: Error refreshing shapes:`, error)
|
console.error(`📊 Board: Error refreshing shapes:`, error)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue