Skip to content

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

Fix octokit mobile bug (#21316)

Francesco Sansalvadore90ab549d611b
diff --git a/apps/www/components/Nav/GitHubButton.tsx b/apps/www/components/Nav/GitHubButton.tsx
index d9dafdf36c2..b59232b4fa6 100644
--- a/apps/www/components/Nav/GitHubButton.tsx
+++ b/apps/www/components/Nav/GitHubButton.tsx
@@ -1,13 +1,10 @@
import React, { useEffect, useState } from 'react'
import { Button } from 'ui'
-import { Octokit } from '@octokit/core'
const GitHubButton = () => {
- const [stars, setStars] = useState<string>('60.8')
- const octokit = new Octokit()
+ const [stars, setStars] = useState<string>('63')
const kFormatter = (num: number) => {
- const octokit = new Octokit()
const kFormat = num / 1000
const decimals = kFormat.toFixed(2).split('.')[1]
const firstDecimal = decimals.split('')[0]
@@ -18,6 +15,8 @@ const GitHubButton = () => {
useEffect(() => {
async function fetchOctoData() {
+ const { Octokit } = await import('@octokit/core')
+ const octokit = new Octokit()
const res = await octokit.request('GET /repos/{org}/{repo}', {
org: 'supabase',
repo: 'supabase',
diff --git a/apps/www/components/OpenSource/Repos.tsx b/apps/www/components/OpenSource/Repos.tsx
index b89bc1c543b..f70d7f764f4 100644
--- a/apps/www/components/OpenSource/Repos.tsx
+++ b/apps/www/components/OpenSource/Repos.tsx
@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'
import Link from 'next/link'
import { AnimatePresence } from 'framer-motion'
import { Swiper, SwiperSlide } from 'swiper/react'
-import { Octokit } from '@octokit/core'
import { cn } from 'ui'
import LogoLoader from 'ui/src/components/LogoLoader'
@@ -67,7 +66,6 @@ enum SWIPER_STATE {
}
const Repos = ({ tabs }: Props) => {
- const octokit = new Octokit()
const [repos, setRepos] = useState<any[] | null>(null)
const [activeTab, setActiveTab] = useState(0)
const [apiSwiper, setApiSwiper] = useState(undefined)
@@ -75,6 +73,8 @@ const Repos = ({ tabs }: Props) => {
useEffect(() => {
async function fetchOctoData() {
+ const { Octokit } = await import('@octokit/core')
+ const octokit = new Octokit()
const res = await octokit.request('GET /orgs/{org}/repos', {
org: 'supabase',
type: 'public',
diff --git a/apps/www/pages/changelog.tsx b/apps/www/pages/changelog.tsx
index e41dec83e85..f655dd3e7bb 100644
--- a/apps/www/pages/changelog.tsx
+++ b/apps/www/pages/changelog.tsx
@@ -7,7 +7,6 @@ import DefaultLayout from '~/components/Layouts/Default'
import mdxComponents from '~/lib/mdx/mdxComponents'
import { mdxSerialize } from '~/lib/mdx/mdxSerialize'
import { createAppAuth } from '@octokit/auth-app'
-import { Octokit } from '@octokit/core'
import { Octokit as OctokitRest } from '@octokit/rest'
import { paginateGraphql } from '@octokit/plugin-paginate-graphql'
import { GetServerSideProps } from 'next'
@@ -15,9 +14,6 @@ import Link from 'next/link'
import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/outline'
import { deletedDiscussions } from '~/lib/changelog.utils'
-export const ExtendedOctokit = Octokit.plugin(paginateGraphql)
-export type ExtendedOctokit = InstanceType<typeof ExtendedOctokit>
-
export type Discussion = {
id: string
updatedAt: string
@@ -98,6 +94,10 @@ export const getServerSideProps: GetServerSideProps = async ({ res, query }) =>
// uses the graphql api
async function fetchDiscussions(owner: string, repo: string, categoryId: string, cursor: string) {
+ const { Octokit } = await import('@octokit/core')
+ const ExtendedOctokit = Octokit.plugin(paginateGraphql)
+ type ExtendedOctokit = InstanceType<typeof ExtendedOctokit>
+
const octokit = new ExtendedOctokit({
authStrategy: createAppAuth,
auth: {