fix new user error + add wrangler.toml examples

This commit is contained in:
Ishaan Dey 2024-05-22 20:06:16 -07:00
parent f35e5debff
commit 8e49fed48b
6 changed files with 52 additions and 2 deletions

View File

@ -0,0 +1,10 @@
name = "ai"
main = "src/index.ts"
compatibility_date = "2024-05-12"
compatibility_flags = ["nodejs_compat"]
[ai]
binding = "AI"
[vars]
KEY = ""

View File

@ -43,6 +43,13 @@
"when": 1714950365718, "when": 1714950365718,
"tag": "0005_last_the_twelve", "tag": "0005_last_the_twelve",
"breakpoints": true "breakpoints": true
},
{
"idx": 6,
"version": "5",
"when": 1716432225404,
"tag": "0006_lively_mattie_franklin",
"breakpoints": true
} }
] ]
} }

View File

@ -28,6 +28,7 @@ export const sandbox = sqliteTable("sandbox", {
name: text("name").notNull(), name: text("name").notNull(),
type: text("type", { enum: ["react", "node"] }).notNull(), type: text("type", { enum: ["react", "node"] }).notNull(),
visibility: text("visibility", { enum: ["public", "private"] }), visibility: text("visibility", { enum: ["public", "private"] }),
createdAt: integer("createdAt", { mode: "timestamp_ms" }),
userId: text("user_id") userId: text("user_id")
.notNull() .notNull()
.references(() => user.id), .references(() => user.id),

View File

@ -0,0 +1,12 @@
#:schema node_modules/wrangler/config-schema.json
name = "database"
main = "src/index.ts"
compatibility_date = "2024-04-05"
compatibility_flags = ["nodejs_compat"]
services = [{ binding = "STORAGE", service = "storage" }]
[[d1_databases]]
binding = "DB"
database_name = ""
database_id = ""

View File

@ -0,0 +1,13 @@
#:schema node_modules/wrangler/config-schema.json
name = "storage"
main = "src/index.ts"
compatibility_date = "2024-04-05"
compatibility_flags = ["nodejs_compat"]
account_id = ""
workers_dev = true
[[r2_buckets]]
binding = 'R2'
bucket_name = ''
preview_bucket_name = ''

View File

@ -10,13 +10,13 @@ import {
Settings, Settings,
Users, Users,
} from "lucide-react"; } from "lucide-react";
import { useState } from "react"; import { useEffect, useState } from "react";
import { Sandbox } from "@/lib/types"; import { Sandbox } from "@/lib/types";
import DashboardProjects from "./projects"; import DashboardProjects from "./projects";
import DashboardSharedWithMe from "./shared"; import DashboardSharedWithMe from "./shared";
import NewProjectModal from "./newProject"; import NewProjectModal from "./newProject";
import Link from "next/link"; import Link from "next/link";
import { useSearchParams } from "next/navigation"; import { useRouter, useSearchParams } from "next/navigation";
import AboutModal from "./about"; import AboutModal from "./about";
import { toast } from "sonner"; import { toast } from "sonner";
@ -47,6 +47,13 @@ export default function Dashboard({
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const q = searchParams.get("q"); const q = searchParams.get("q");
const router = useRouter();
useEffect(() => {
if (!sandboxes) {
router.refresh();
}
}, [sandboxes]);
return ( return (
<> <>