-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/visibility #100
Feature/visibility #100
Conversation
ndrsllwngr
commented
Jan 20, 2021
•
edited
Loading
edited
- Move db logs in useSingleMeme to finally promise
- Fix linter warning
- Add UnauthorizedPage /403
- Add auth verification on /meme/[id] for private memes
- Clear singlememeContext properly while routing to another page
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ndrsllwngr/omm/nc0ku6816 |
📝Changed routes:
Commit 3ce5477 (https://omm-nc0ku6816.vercel.app). |
}) | ||
} | ||
} | ||
}, [router, currentMeme, updateCurrent]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this useEffect which is similar to the one we have in the autoplayContext. Otherwise we would get a short flash of the old currentMeme when visiting from another page. This useEffect clears the context properly if the user leaves /meme/[id].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfekt!
components/Slideshow.js
Outdated
{meme.visibility === VISIBILITY.PUBLIC && ( | ||
<> | ||
{prevMeme && prevMeme.id ? ( | ||
<SlideshowButton name="prev" changeSlide={prevMeme.id} /> | ||
) : ( | ||
<SlideshowButton name="prev" disabled={true} /> | ||
)} | ||
{nextMeme && nextMeme.id && meme.visibility === VISIBILITY.PUBLIC ? ( | ||
<SlideshowButton name="next" changeSlide={nextMeme.id} /> | ||
) : ( | ||
<SlideshowButton name="next" disabled={true} /> | ||
)} | ||
</> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure if this matches all cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the outer condition but not the inner one with "meme.visibility === VISIBILITY.PUBLIC"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @maxrawlinger the inner is legacy code from an earlier attempt. I am going to remove it!
}) | ||
} | ||
} | ||
}, [router, currentMeme, updateCurrent]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfekt!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work! 🍕