Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Adding a gif for the slack demo

Paul Copplestone0d154c9a2ece
diff --git a/examples/slack-clone-basic/README.md b/examples/slack-clone-basic/README.md
index 92de000910f..d58b9fc0cdd 100644
--- a/examples/slack-clone-basic/README.md
+++ b/examples/slack-clone-basic/README.md
@@ -1,6 +1,13 @@
# Example chat room
-@todo
+Build a simple slack clone using Supabase, Postgres and React hooks.
+
+
+<p align="center">
+<kbd>
+<a href="https://media.giphy.com/media/J07U8iblJhlKDqZOxV/source.gif"><img src="https://media.giphy.com/media/J07U8iblJhlKDqZOxV/giphy.gif" alt="Demo"/></a>
+</kbd>
+</p>
## How to use
@@ -22,4 +29,6 @@ docker-compose up -d
```sh
npm run dev
-```
\ No newline at end of file
+```
+
+Visit http://localhost:3000 and start slacking! Open in two tabs to see everything getting updated in realtime
\ No newline at end of file
diff --git a/examples/slack-clone-basic/lib/Store.js b/examples/slack-clone-basic/lib/Store.js
index 88f42bb2217..fa4c6626bba 100644
--- a/examples/slack-clone-basic/lib/Store.js
+++ b/examples/slack-clone-basic/lib/Store.js
@@ -34,11 +34,11 @@ export const useStore = props => {
.on('*', payload => handleNewChannel(payload.new))
.subscribe()
// Cleanup on unmount
- // return () => {
- // messageListener.unsubscribe()
- // userListener.unsubscribe()
- // channelListener.unsubscribe()
- // }
+ return () => {
+ messageListener.unsubscribe()
+ userListener.unsubscribe()
+ channelListener.unsubscribe()
+ }
}, [])
// Update when the route changes
@@ -51,7 +51,7 @@ export const useStore = props => {
// New message recieved from Postgres
useEffect(() => {
- if (newMessage) {
+ if (newMessage && newMessage.channel_id == props.channelId) {
const handleAsync = async () => {
let authorId = newMessage.user_id
if (!users.get(authorId)) await fetchUser(authorId, user => handleNewOrUpdatedUser(user))