From c2d41e7045a20c0af748ea9fc47ad588e0007ded Mon Sep 17 00:00:00 2001 From: kangmingtay Date: Tue, 25 May 2021 17:35:24 +0800 Subject: [PATCH] fix: null channels bug --- examples/nextjs-slack-clone/lib/Store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nextjs-slack-clone/lib/Store.js b/examples/nextjs-slack-clone/lib/Store.js index 4be314073e8..432edcb7366 100644 --- a/examples/nextjs-slack-clone/lib/Store.js +++ b/examples/nextjs-slack-clone/lib/Store.js @@ -99,7 +99,7 @@ export const useStore = (props) => { return { // We can export computed values here to map the authors to each message messages: messages.map((x) => ({ ...x, author: users.get(x.user_id) })), - channels: channels.sort((a, b) => a.slug.localeCompare(b.slug)), + channels: (channels !== null) ? channels.sort((a, b) => a.slug.localeCompare(b.slug)) : [], users, } }