Skip to content

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

fix: filtering

Jonathan Summers-Muir4e66efe446b7
diff --git a/apps/www/pages/blog.tsx b/apps/www/pages/blog.tsx
index 9b367e7f7c8..41184b1791d 100644
--- a/apps/www/pages/blog.tsx
+++ b/apps/www/pages/blog.tsx
@@ -38,27 +38,25 @@ function Blog(props: any) {
const router = useRouter()
- // useEffect(() => {
- // // contruct an array of blog posts
- // // not inluding the first blog post
- // const shiftedBlogs = [...props.blogs]
- // shiftedBlogs.shift()
-
- // setBlogs(
- // category === 'all'
- // ? shiftedBlogs
- // : props.blogs.filter((post: any) => {
- // const found = post.tags.includes(category)
- // return found
- // })
- // )
- // }, [category])
-
- // useEffect(() => {
- // return props.categories.unshift('all')
- // }, [])
-
- // console.log('state blogs', blogs[0])
+ useEffect(() => {
+ // contruct an array of blog posts
+ // not inluding the first blog post
+ const shiftedBlogs = [...props.blogs]
+ shiftedBlogs.shift()
+
+ setBlogs(
+ category === 'all'
+ ? shiftedBlogs
+ : props.blogs.filter((post: any) => {
+ const found = post.tags.includes(category)
+ return found
+ })
+ )
+ }, [category])
+
+ useEffect(() => {
+ return props.categories.unshift('all')
+ }, [])
// append 'all' category
// const categories = props.categories.push('all')