Skip to content

Commit

Permalink
update examples to use latest router
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Oct 31, 2024
1 parent d6d8646 commit 0060b3b
Show file tree
Hide file tree
Showing 22 changed files with 1,764 additions and 1,367 deletions.
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"solid-js": "^1.9.2",
"vinxi": "^0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/experiments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"solid-js": "^1.9.2",
"vinxi": "^0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "vinxi start"
},
"dependencies": {
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"solid-js": "^1.9.2",
"vinxi": "^0.4.3"
Expand Down
8 changes: 4 additions & 4 deletions examples/hackernews/src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cache } from "@solidjs/router";
import { query } from "@solidjs/router";
import { StoryDefinition, StoryTypes, UserDefinition } from "~/types";

const story = (path: string) => `https://node-hnapi.herokuapp.com/${path}`;
Expand Down Expand Up @@ -34,17 +34,17 @@ const mapStories = {
job: "jobs"
} as const;

export const getStories = cache(async (type: StoryTypes, page: number): Promise<StoryDefinition[]> => {
export const getStories = query(async (type: StoryTypes, page: number): Promise<StoryDefinition[]> => {
"use server";
return fetchAPI(`${mapStories[type]}?page=${page}`);
}, "stories");

export const getStory = cache(async (id: string): Promise<StoryDefinition> => {
export const getStory = query(async (id: string): Promise<StoryDefinition> => {
"use server";
return fetchAPI(`item/${id}`);
}, "story");

export const getUser = cache(async (id: string): Promise<UserDefinition> => {
export const getUser = query(async (id: string): Promise<UserDefinition> => {
"use server";
return fetchAPI(`user/${id}`);
}, "user");
2 changes: 1 addition & 1 deletion examples/notes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "vinxi start"
},
"dependencies": {
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"date-fns": "^3.6.0",
"solid-js": "^1.9.2",
Expand Down
8 changes: 4 additions & 4 deletions examples/notes/src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { action, cache, redirect } from "@solidjs/router";
import { action, query, redirect } from "@solidjs/router";
import { format, isToday } from "date-fns";
import { marked } from "marked";
import { storage } from "./db";
import type { Note } from "./types";

export const getNotes = cache(async (searchText: string) => {
export const getNotes = query(async (searchText: string) => {
"use server";
return (((await storage.getItem("notes:data")) as Note[]) || [])
.filter(note => !searchText || note.title.toLowerCase().includes(searchText.toLowerCase()))
Expand All @@ -17,12 +17,12 @@ export const getNotes = cache(async (searchText: string) => {
});
}, "notes");

export const getNote = cache(async (id: number) => {
export const getNote = query(async (id: number) => {
"use server";
return (((await storage.getItem("notes:data")) as Note[]) || []).find(note => note.id === id);
}, "note");

export const getNotePreview = cache(async (id: number) => {
export const getNotePreview = query(async (id: number) => {
"use server";
const note = (((await storage.getItem("notes:data")) as Note[]) || []).find(
note => note.id === id
Expand Down
2 changes: 1 addition & 1 deletion examples/todomvc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "vinxi start"
},
"dependencies": {
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"solid-js": "^1.9.2",
"unstorage": "1.10.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/todomvc/src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { action, cache } from "@solidjs/router";
import { action, query } from "@solidjs/router";
import type { Todo } from "~/types";
import { storage } from "./db";

export const getTodos = cache(async () => {
export const getTodos = query(async () => {
"use server";
return ((await storage.getItem("todos:data")) as Todo[]) || [];
}, "todos");
Expand Down
2 changes: 1 addition & 1 deletion examples/with-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@types/node": "^20.12.7"
},
"dependencies": {
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"solid-js": "^1.9.2",
"unstorage": "1.10.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-auth/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { action, cache, redirect } from "@solidjs/router";
import { action, query, redirect } from "@solidjs/router";
import { db } from "./db";
import {
getSession,
Expand All @@ -9,7 +9,7 @@ import {
validateUsername
} from "./server";

export const getUser = cache(async () => {
export const getUser = query(async () => {
"use server";
try {
const session = await getSession();
Expand Down
2 changes: 1 addition & 1 deletion examples/with-drizzle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"drizzle-kit": "^0.22.7"
},
"dependencies": {
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.2",
"better-sqlite3": "^11.0.0",
"drizzle-orm": "^0.31.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-drizzle/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action, cache } from "@solidjs/router";
import { action, query } from "@solidjs/router";
import { getUser as gU, logout as l, loginOrRegister as lOR } from "./server";

export const getUser = cache(gU, "user");
export const getUser = query(gU, "user");
export const loginOrRegister = action(lOR, "loginOrRegister");
export const logout = action(l, "logout");
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@mdx-js/mdx": "^2.3.0",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"@vinxi/plugin-mdx": "^3.7.1",
"solid-js": "^1.9.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@prisma/client": "^5.12.1",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"prisma": "^5.12.1",
"solid-js": "^1.9.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-prisma/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { action, cache, redirect } from "@solidjs/router";
import { action, query, redirect } from "@solidjs/router";
import { db } from "./db";
import {
getSession,
Expand All @@ -9,7 +9,7 @@ import {
validateUsername
} from "./server";

export const getUser = cache(async () => {
export const getUser = query(async () => {
"use server";
try {
const session = await getSession();
Expand Down
2 changes: 1 addition & 1 deletion examples/with-solid-styled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"solid-js": "^1.9.2",
"solid-styled": "^0.11.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "vinxi start"
},
"dependencies": {
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-unocss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "vinxi start"
},
"dependencies": {
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"@unocss/reset": "^0.59.2",
"solid-js": "^1.9.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "module",
"devDependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.9",
"@solidjs/testing-library": "^0.8.10",
"@testing-library/jest-dom": "^6.6.2",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@kobalte/core": "^0.13.1",
"@kobalte/utils": "^0.9.0",
"@solidjs/meta": "^0.29.0",
"@solidjs/router": "^0.14.10",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "workspace:*",
"@tailwindcss/typography": "^0.5.9",
"@vinxi/plugin-mdx": "^3.7.1",
Expand Down
Loading

0 comments on commit 0060b3b

Please sign in to comment.