Getting `Cannot read property 'forEach' of undefined` while updating the cache after mutation

Hey folks :wave:

I鈥檓 getting this error while updating the cache after creating a post (Mutation).

This is how my update code looks like - src/components/Post/NewPost/Type/Post.tsx 路 main 路 Yogi / Devparty 路 GitLab

update(cache, { data }) {
    if (!data?.createPost) return

    cache.modify({
        fields: {
            posts: (previousPosts, { toReference }) => {
                return [...previousPosts.edges, toReference(data?.createPost)]
            }
        }
    })
},

Also I鈥檓 using relayStylePagination - File: apollo.ts

cache: new InMemoryCache({
    typePolicies: {
        Query: {
            fields: {
                posts: relayStylePagination(),
                replies: relayStylePagination()
            }
        }
    }
})