Skip to content
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

Add user posts #64

Merged
merged 13 commits into from
May 24, 2020
Merged

Add user posts #64

merged 13 commits into from
May 24, 2020

Conversation

hoangvvo
Copy link
Owner

@hoangvvo hoangvvo commented May 6, 2020

This adds a user posting system, like status update, tweeting, etc.

@vercel
Copy link

vercel bot commented May 6, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hoangvvo/nextjs-mongodb-app/5kqrpz5sw
✅ Preview: https://nextjs-mongodb-app-git-posting.hoangvvo.now.sh

@hoangvvo hoangvvo changed the title Add user posting Add user posts May 6, 2020
@hoangvvo
Copy link
Owner Author

hoangvvo commented May 6, 2020

swr really has awful documentation...

@hoangvvo
Copy link
Owner Author

hoangvvo commented May 6, 2020

I'm currently not know how to reset useSWRPages (which is not even in the documentation 😵) state

@hoangvvo hoangvvo added the help wanted Extra attention is needed label May 6, 2020
@vercel vercel bot requested a deployment to Preview May 6, 2020 03:05 Abandoned
@wortkotze
Copy link

wortkotze commented May 7, 2020

I'm currently not know how to reset useSWRPages (which is not even in the documentation 😵) state

for which usecase do you need an reset?
probably this helps:
https://sergiodxa.com/articles/swr/pagination/

@hoangvvo
Copy link
Owner Author

hoangvvo commented May 7, 2020

@wortkotze When a user make a post, I want it to appear immediately under the feed. I tried @shuding's workaround but it didn't work somehow.

Take a look at vercel/swr#189

@hoangvvo
Copy link
Owner Author

hoangvvo commented May 7, 2020

The article you mention is pretty interesting though. I would love to implement an infinity scrolled pagination (right now we need to press a button)

@wortkotze
Copy link

The article you mention is pretty interesting though. I would love to implement an infinity scrolled pagination (right now we need to press a button)

I'm not sure but you could use the mutation of the swr
https://github.com/zeit/swr#mutation-and-post-request

with mutate you can change the api-url of swr or the load. in this way you could change the data that you are requesting

@hoangvvo
Copy link
Owner Author

hoangvvo commented May 8, 2020

The article you mention is pretty interesting though. I would love to implement an infinity scrolled pagination (right now we need to press a button)

I'm not sure but you could use the mutation of the swr
https://github.com/zeit/swr#mutation-and-post-request

with mutate you can change the api-url of swr or the load. in this way you could change the data that you are requesting

I did try that but somehow did not manage to get it to work. I tried to use mutate on swrPages[0] (the first in all paginations) but somehow it didn't work

@hoangvvo
Copy link
Owner Author

I'll merge it for now. Will also post an issue to keep track of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants