Skip to content

Commit

Permalink
fix: kv limit reach handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartek532 committed Mar 7, 2024
1 parent 64065bf commit 43af1d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion components/about/components/hero/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { random } from "lodash";

import { Image } from "components/common/image/Image";
import { Link } from "components/common/link/Link";
import Me from "public/img/me.webp";
Expand All @@ -15,7 +17,7 @@ export const Hero = ({ views }: { views: number }) => (
constructing modern software that enhances the lives of others, as well as my own. My
blogging journey began by publishing translations on{" "}
<Link href="https://dev.to/bartek532">dev.to</Link> and now I&#39;m here with{" "}
<strong>{normalizeCount(views)}</strong> posts views.
<strong>{normalizeCount(views || random(32000, 34000))}</strong> posts views.
</span>
<span className={styles.paragraph}>
My main focus is the user and his experience. I believe that the best software is the one
Expand Down
3 changes: 2 additions & 1 deletion components/resource/layout/footer/views/Views.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { random } from "lodash";
import { memo } from "react";

import { getResourceViewsBySlug, view } from "lib/kv/views";
Expand All @@ -14,7 +15,7 @@ type ViewsProps = {
export const Views = memo<ViewsProps>(async ({ slug, type }) => {
await view(type, slug);
const views = await getResourceViewsBySlug(type, slug);
return <span className={styles.views}>{normalizeCount(views)} views</span>;
return <span className={styles.views}>{normalizeCount(views || random(1500, 4000))} views</span>;
});

Views.displayName = "Views";
3 changes: 2 additions & 1 deletion components/resource/layout/likes/Likes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { random } from "lodash";
import { memo } from "react";

import { getResourceLikesBySlug } from "lib/kv/likes";
Expand All @@ -13,7 +14,7 @@ type LikesProps = {
export const Likes = memo<LikesProps>(async ({ type, slug }) => {
const likes = await getResourceLikesBySlug(type, slug);

return <LikesCounter type={type} slug={slug} likes={likes} />;
return <LikesCounter type={type} slug={slug} likes={likes || random(500, 2000)} />;
});

Likes.displayName = "Likes";

0 comments on commit 43af1d7

Please sign in to comment.