Generate SSG Page used as cache for user's third-party calendar
What does this PR do?
- Generate a SSG page used as cache for user`s third-party calendars by month, this page revalidates each second.
- tRCP getSchedule endpoint change: now get the generated json file for the SSG page which is normally used by NextJS in the browser navigation to get the third-party calendar data
TODO
- [x] Revalidate cache page when users connect/disconnect a calendar.
- [x] Revalidate when users change the selected calendars.
- [ ] Revalidate when the user adds or deletes an event directly in the connected calendars via webhooks.
- [x] Add API endpoint to revalidates several months ahead.
Fixes #4535 /claim #4535
Note: On development environment the response time of getSchedule endpoint increases because NextJS compiles the cache page first. To notice the improvement you must run a production build.
Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] Chore (refactoring code, technical debt, workflow improvements)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
Checklist
- I haven't read the contributing guide
- My code doesn't follow the style guidelines of this project
- I haven't checked if my PR needs changes to the documentation
- I haven't checked if my changes generate no new warnings
- I haven't added tests that prove my fix is effective or that my feature works
- I haven't checked if new and existing unit tests pass locally with my changes
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated |
|---|---|---|---|---|
| cal | ✅ Ready (Inspect) | Visit Preview | 💬 Add your feedback | Feb 13, 2023 at 6:44PM (UTC) |
1 Ignored Deployment
| Name | Status | Preview | Comments | Updated |
|---|---|---|---|---|
| ui | ⬜️ Ignored (Inspect) | Visit Preview | Feb 13, 2023 at 6:44PM (UTC) |
@roae is attempting to deploy a commit to the cal Team on Vercel.
A member of the Team first needs to authorize it.
is this related to the RFC for caching calendars or is this unrelated?
is this related to the RFC for caching calendars or is this unrelated?
It is a different approach @PeerRich no need for a custom caldav server (at least not yet)
@roae can you uncommit your yarn.lock? (take it from our main)
@roae can you uncommit your yarn.lock? (take it from our main)
Done!
lovely progress here
Added a canary domain preview to test the difference So far getting a response time average of 1.8 seconds
do you have a benchmark of before/after with same payload / connected calendars?
do you have a benchmark of before/after with same payload / connected calendars?

HOLY SHIT 4s down to 240ms?!
HOLY SHIT 4s down to 240ms?!
Of course it varies between calls but still pretty impressive 🙌🏽
unfortunately there is a new skeleton loader that wasnt there on current prod
CleanShot.2023-02-10.at.22.28.19.mp4
Adding more context to this change. We discovered that if a slot got taken and refetched it didn't disappear in the UI due the use of our local state. But agreed that we can improve the UX to match the previous one.
I'm like 70% sure you can return from an API endpoint in Next with infinite cache times and not have to do the empty page hack - I do this all the time - revalidate works on API endpoints
I'm like 70% sure you can return from an API endpoint in Next with infinite cache times and not have to do the empty page hack - I do this all the time -
revalidateworks on API endpoints
Care to elaborate @t3dotgg ? Is this cache useful for every user or would it only work per browser/request?
unfortunately there is a new skeleton loader that wasnt there on current prod
CleanShot.2023-02-10.at.22.28.19.mp4
Skeleton got fixed
https://www.loom.com/share/4351b946528349dd87e201aa98bbca32
Merging for now. We can always follow up with further improvements. Talked to @roae and it seems like the next big thing to solve would be reducing bundle size.

nice lets merge! should I or do you wanna click the magic green button
whopsy wrong button clicky

Talked to @roae and it seems like the next big thing to solve would be reducing bundle size.
I searched the current main. There are a few cases where the entire lodash is being imported for no reason. Should be a very easy fix that instantly reduces bundle size.

Did this in another project the other day, before/after:

i think we can get rid of lodash alltogether no? most of lodash is ECMA specs now anyway