Skip to content

Commit

Permalink
chore: add highlight id to useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Jul 12, 2023
1 parent b26c9af commit e1a1ef0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pages/feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const Feeds: WithPageLayout<HighlightSSRProps> = (props: HighlightSSRProps) => {
const [hydrated, setHydrated] = useState(false);

const singleHighlight = props.highlight;
const id = props.highlight?.id;
const ogImage = props?.highlight
? `${process.env.NEXT_PUBLIC_OPENGRAPH_URL}/highlights/${props.highlight.id}`
: undefined;
Expand Down Expand Up @@ -89,20 +88,21 @@ const Feeds: WithPageLayout<HighlightSSRProps> = (props: HighlightSSRProps) => {
}, [activeTab, followersRepo, repos]);

useEffect(() => {
console.log("id", props.highlight?.id);
if (selectedRepo) {
router.push(`/feed?repo=${selectedRepo}`);
setPage(1);
}
if (id) {
if (props.highlight?.id) {
setOpenSingleHighlight(true);
router.push(`/feed/${id}`);
router.push(`/feed/${props.highlight?.id}`);
}

if (!selectedRepo && !id) {
if (!selectedRepo && !props.highlight?.id) {
router.push("/feed");
setPage(1);
}
}, [selectedRepo, id]);
}, [selectedRepo, props.highlight?.id]);

useEffect(() => {
setHydrated(true);
Expand Down

0 comments on commit e1a1ef0

Please sign in to comment.