Skip to content

Commit

Permalink
fix: writing publish alert block
Browse files Browse the repository at this point in the history
  • Loading branch information
OXeu committed Jul 11, 2024
1 parent 16cee03 commit 4d50a8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions client/src/components/feed_card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Link } from "wouter";
import { useTranslation } from "react-i18next";
import { timeago } from "../utils/timeago";
import { HashTag } from "./hashtag";
import { useMemo } from "react";
export function FeedCard({ id, title, avatar, draft, listed, top, summary, hashtags, createdAt, updatedAt }:
{
id: string, avatar?: string,
Expand All @@ -11,7 +12,7 @@ export function FeedCard({ id, title, avatar, draft, listed, top, summary, hasht
createdAt: Date, updatedAt: Date
}) {
const { t } = useTranslation()
return (
const UI = useMemo(() => (
<>
<Link href={`/feed/${id}`} target="_blank" className="w-full rounded-2xl bg-w my-2 p-6 duration-300 ani-show bg-button">
{avatar &&
Expand Down Expand Up @@ -52,5 +53,6 @@ export function FeedCard({ id, title, avatar, draft, listed, top, summary, hasht

</Link>
</>
)
), [id, title, avatar, draft, listed, top, summary, hashtags, createdAt, updatedAt])
return UI
}
7 changes: 4 additions & 3 deletions client/src/page/writing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ async function publish({
showAlert(error.value as string);
}
if (data && typeof data !== "string") {
showAlert(t("publish.success"));
Cache.with().clear();
window.location.href = "/feed/" + data.insertedId;
showAlert(t("publish.success"), () => {
Cache.with().clear();
window.location.href = "/feed/" + data.insertedId;
});
}
}

Expand Down

0 comments on commit 4d50a8f

Please sign in to comment.