sam-goodwin / eventual

Build scalable and durable micro-services with APIs, Messaging and Workflows
https://docs.eventual.ai
MIT License
173 stars 4 forks source link

Local not restoring Set data type in Entity #453

Open sam-goodwin opened 9 months ago

sam-goodwin commented 9 months ago

If an Entity contains a Set:

const Topic = z.object({
  topicID: z.string().uuid(),
  subscribers: z.set(z.string()),
});

Then it is not properly reified when restarting local

file:///Users/samgoodwin/workspaces/eventual-service/packages/service/lib/yjs/subscriptions.js:26
                subscribers: topic?.subscribers.add(connectionId) ?? new Set([connectionId]),
                                                ^

TypeError: topic?.subscribers.add is not a function
    at file:///Users/samgoodwin/workspaces/eventual-service/packages/service/src/yjs/subscriptions.ts:40:32
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
sam-goodwin commented 9 months ago

Looks like it also doesn't serialize it properly.

{}