next.js - Can't modify storage LiveObject while using liveblocks - Stack Overflow

admin2025-04-26  11

I am trying to implement a storage LiveObject, when I try to modify it using set method, inside useMutation hook, it gives error "TypeError: thisCentralCard.set is not a function" :

Below is the useMutation hook I tried implementing, which is similar to the example shown in liveblocks storage tutorial.

const updateCentralCard = useMutation(({ storage }, newCard: Card) => {
    const thisCentralCard = storage.get("centralCard") as LiveObject<{color: string, value: string}>;
    console.log(thisCentralCard)
    
    thisCentralCard.set("color", newCard.color);
    thisCentralCard.set("value", newCard.value);
  }, []);
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745665451a313002.html

最新回复(0)