Skip to content

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

fix: fix warnings

Jonathan Summers-Muirac5de3a89db9
diff --git a/www/_blog/2020-08-05-supabase-auth.mdx b/www/_blog/2020-08-05-supabase-auth.mdx
index 0a0b8f5abd0..71644d4c3e0 100644
--- a/www/_blog/2020-08-05-supabase-auth.mdx
+++ b/www/_blog/2020-08-05-supabase-auth.mdx
@@ -60,21 +60,18 @@ Authentication only gets you so far. When you need granular authorization rules,
With policies, your database becomes the rules engine. Instead of repetitively filtering your queries, like this ...
-<CodeBlock
- code={`const loggedInUserId = 'd0714948'
+```js
+const loggedInUserId = 'd0714948'
let user = await supabase.from('users').select('user_id, name').eq('user_id', loggedInUserId)\n
// Returns { id: 'd0714948', name: 'Jane'
-`}
- lang="js"
-/>
+```
... you can simply define a rule on your database table, `auth.uid() = user_id`, and your request will return the rows which pass the rule, even when you remove the filter from your middleware:
-<CodeBlock
- code={`let user = await supabase.from('users').select('user_id, name')\n
-// Still returns { id: 'd0714948', name: 'Jane' }`}
- lang="js"
-/>
+```js
+let user = await supabase.from('users').select('user_id, name')\n
+// Still returns { id: 'd0714948', name: 'Jane' }
+```
### Open source
diff --git a/www/_blog/2020-10-30-improved-dx.mdx b/www/_blog/2020-10-30-improved-dx.mdx
index 114251c6e96..c58786cf7ca 100644
--- a/www/_blog/2020-10-30-improved-dx.mdx
+++ b/www/_blog/2020-10-30-improved-dx.mdx
@@ -30,24 +30,21 @@ We attribute this improvement to community feedback. This has significantly impr
Previously we would throw errors:
-<CodeBlock
- code={`try {
+```js
+try {
const { body } = supabase.from('todos').select('*')
} catch (error) {
console.log(error)
-}`}
- lang="js"
- hideCopy
-/>
+}
+```
And now we simply return them:
-<CodeBlock
- code={`const { data, error } = supabase.from('todos').select('*')
+```js
+const { data, error } = supabase.from('todos').select('*')
if (error) console.log(error)\n
-// else, carry on ..`}
- lang="js"
-/>
+// else, carry on ..
+```
After testing this for a while we're very happy with this pattern. Errors are handled next to the offending function. Of course you can always rethrow the error if that's your preference.
@@ -59,23 +56,20 @@ To maintain this philosophy, we created [`gotrue-js`](https://github.com/supabas
Previously:
-<CodeBlock
- code={`const {
+```js
+const {
body: { user },
-} = await supabase.auth.signup('[email protected]', 'password')`}
- lang="js"
- hideCopy
-/>
+} = await supabase.auth.signup('[email protected]', 'password')
+```
Now:
-<CodeBlock
- code={`const { user, error } = await supabase.auth.signUp({
+```js
+const { user, error } = await supabase.auth.signUp({
password: 'password',
-})`}
- lang="js"
-/>
+})
+```
### Enhancements and fixes
@@ -97,11 +91,15 @@ We've bumped the major version because there are a number of breaking changes. W
Previously:
-<CodeBlock code={`const {body} = supabase.from('todos').select('*')`} lang="js" hideCopy />
+```js
+const { body } = supabase.from('todos').select('*')
+```
Now:
-<CodeBlock code={`const {data} = supabase.from('todos').select()`} lang="js" />
+```js
+const { data } = supabase.from('todos').select()
+```
### Upgrading
diff --git a/www/_blog/2020-12-13-supabase-dashboard-performance.mdx b/www/_blog/2020-12-13-supabase-dashboard-performance.mdx
index 40defdf17d9..2cd55b2b6fc 100644
--- a/www/_blog/2020-12-13-supabase-dashboard-performance.mdx
+++ b/www/_blog/2020-12-13-supabase-dashboard-performance.mdx
@@ -53,17 +53,15 @@ We reverted our [crypto-js](https://github.com/brix/crypto-js) module from versi
By selectively importing functions from modules like `lodash`, we cut the gzipped size by another 40kb across all our bundles.
-<CodeBlock
- code={`// before
+```js
+// before
import _ from 'lodash'\n
// maunally cherry picking modules
import find from 'lodash/find'
import debounce from 'lodash/debounce'\n
// using babel-plugin-lodash
import { find, debounce } from 'lodash'
-`}
- lang="js"
-/>
+```
In the above example, we added [babel-plugin-lodash](https://github.com/lodash/babel-plugin-lodash) to our babel configuration which cherry picks the exact `lodash` functions we import. This makes it easier to import from `lodash` without cluttering the code with selective import statements.
diff --git a/www/_blog/2021-01-02-supabase-beta-december-2020.mdx b/www/_blog/2021-01-02-supabase-beta-december-2020.mdx
index f32cec50fbc..df53233bda6 100644
--- a/www/_blog/2021-01-02-supabase-beta-december-2020.mdx
+++ b/www/_blog/2021-01-02-supabase-beta-december-2020.mdx
@@ -14,8 +14,6 @@ date: '01-02-2020'
After 10 hectic months of building, Supabase is now in Beta.
-<!--truncate-->
-
### Quick demo
Watch a full demo:
diff --git a/www/pages/blog/[slug].tsx b/www/pages/blog/[slug].tsx
index 444a93f275b..03e14707dd5 100644
--- a/www/pages/blog/[slug].tsx
+++ b/www/pages/blog/[slug].tsx
@@ -71,10 +71,18 @@ export async function getStaticProps({ params }: any) {
})
.indexOf(params.slug)
+ console.log('currentIndex', currentIndex)
+ console.log('allPosts.length', allPosts.length)
+
+ console.log('nextPost', allPosts[currentIndex + 1])
+
+ const nextPost = allPosts[currentIndex + 1]
+ const prevPost = allPosts[currentIndex - 1]
+
return {
props: {
- prevPost: currentIndex === 0 ? null : allPosts[currentIndex - 1],
- nextPost: currentIndex === allPosts.length ? null : allPosts[currentIndex + 1],
+ prevPost: currentIndex === 0 ? null : prevPost ? prevPost : null,
+ nextPost: currentIndex === allPosts.length ? null : nextPost ? nextPost : null,
relatedPosts,
blog: {
slug: params.slug,
@@ -269,9 +277,9 @@ function BlogPostPage(props: any) {
<div className="grid lg:grid-cols-2 gap-8 py-8">
<div>{props.prevPost && <NextCard post={props.prevPost} label="Last post" />}</div>
<div>
- {props.nextPost && (
+ {/* {props.nextPost && (
<NextCard post={props.nextPost} label="Next post" className="text-right" />
- )}
+ )} */}
</div>
</div>
</div>