When using a dynamic context to display previous or next post data, this works really well, except in the cases of the first and last posts.
Currently there is no built-in condition for us to check whether it is the first or last post to be able to hide the blocks displaying the next post data/link, so the next best solution would be to display the first post when there is no more next post to retrieve.
Here is an example of how this looks in code.
Thank you!