Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.pnp
.pnp.js
yarn.lock
pnpm-lock.yaml
.yarn/cache
bun.lockb
.yarn/install-state.gz
Expand Down
35 changes: 35 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"skipFiles": ["<node_internals>/**"],
"serverReadyAction": {
"pattern": "started server on .+, url: (https?://.+)",
"uriFormat": "%s",
"action": "openExternally"
}
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"serverReadyAction": {
"pattern": "started server on .+, url: (https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}
]
}
3 changes: 2 additions & 1 deletion src/app/(home)/_components/ArticleFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import * as articleActions from "@/backend/services/article.actions";
import ArticleCard from "@/components/ArticleCard";
import VisibilitySensor from "@/components/VisibilitySensor";
import { readingTime } from "@/lib/utils";
import getFileUrl from "@/utils/getFileUrl";
import { useInfiniteQuery } from "@tanstack/react-query";
import VisibilitySensor from "@/components/VisibilitySensor";

const ArticleFeed = () => {
const feedInfiniteQuery = useInfiniteQuery({
Expand All @@ -14,6 +14,7 @@ const ArticleFeed = () => {
articleActions.articleFeed({ limit: 5, page: pageParam }),
initialPageParam: 1,
getNextPageParam: (lastPage) => {
if (!lastPage?.meta.hasNextPage) return undefined;
const _page = lastPage?.meta?.currentPage ?? 1;
return _page + 1;
},
Expand Down
4 changes: 2 additions & 2 deletions src/backend/services/article.actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use server";

import { generateRandomString, removeMarkdownSyntax } from "@/lib/utils";
import { slugify } from "@/lib/slug-helper.util";
import { removeMarkdownSyntax } from "@/lib/utils";
import { z } from "zod";
import { Article, User } from "../models/domain-models";
import { pgClient } from "../persistence/database-drivers/pg.client";
Expand All @@ -18,7 +19,6 @@ import {
} from "./RepositoryException";
import { ArticleRepositoryInput } from "./inputs/article.input";
import { getSessionUserId } from "./session.actions";
import { slugify } from "@/lib/slug-helper.util";

const articleRepository = new PersistentRepository<Article>(
"articles",
Expand Down