const mystate = { id: new Set() } router.addHandler('ABC', async ({ request, crawler, sendRequest, response, body }) => { const state = await crawler.useState(mystate); // now when I try to access the add/has id, I get something like state.id.has is not a function state.id.has('myid123'); })
const mystate = { id: [] } router.addHandler('ABC', async ({ request, crawler, sendRequest, response, body }) => { const state = await crawler.useState(mystate); // now when I try to access the add/has id, I get something like state.id.has is not a function state.id.includes('myid123'); })
Set
is not serializable so when the state is serialized -> stored -> loaded -> deserialized then state.id
becomes an empty object {}
, hence state.id.has
is not a function.