-
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
Block based rendering #443
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
@kilemensi I try to access http://localhost:3000 I get an error
That's why it's not ready for merging just yet @koechkevin ... Pushed a fix for it. |
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.
@kilemensi I have tested this approach and it looks good.
Aaaight @koechkevin but what are you thoughts? Is this approach better that what we have? Can we improve the implementation, etc? The idea is to get everyone's input? |
const res = useArticles(slug, { locale, q, sort, page, pageSize }); | ||
const res = useArticles(collection || slug, { | ||
locale, | ||
q, |
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.
What is this variable q? the other variables represent the actual representation I believe but q is not clear?
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.
q
= query
e.g. https://www.google.com/search?q=code+for+africa
or https://github.com/search?q=code+for+africa&type=repositories
@@ -33,7 +33,7 @@ const LongForm = React.forwardRef(function LongForm(props, ref) { | |||
{content.map((c) => { |
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.
using plurals for naming lists then while using the map method we can use the singular reference
e.g contents.map((content) => { ...
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.
💯 ... except our CMS has chosen to call the page contents content
so we're stuck with that for now.
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.
What CMS are we using?
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.
Payload CMS... Speaking of CMS, I'd also like to hear you views and experiences with various CMSes.
if (!docs?.length) { | ||
return null; | ||
} | ||
const tags = docs.flatMap((doc) => doc.tags).filter((tag) => tag?.slug); |
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.
using typescript might help a lot with unsafe type issues here.
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.
💯 ... that's the next step: monorepo -> ci/cd -> typescript -> end-to-end testing. Happy to hear your suggestions as well.
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.
you mean we are going to convert our codebase based on this steps
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.
Yes-ish.
- We've moved about 3 apps into this monorepo (charter.africa, codeforafrica and promisetracker). We still have a few to go (pesayetu, trolltracker, etc.)
- We've already implemented CI/CD for charter.africa and codeforafrica (you can see the workflows in the repo).
- We have included Jest (for component testing) and Playwright (for end-to-end testing) but we're not really using them that much (just snapshot testing w/ Jest).
So the idea is come up with a comprehensive plan that will allow us to move everything UI into this repo and make sure we have ci/cd -> typescript -> end-to-end testing for all the apps.
const { slug } = page; | ||
|
||
// SWR fallback | ||
let swrKey = `/api/v1/knowledge/${slug}`; |
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.
base end points like this shall change time to time so it should be added to configuration files
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.
Happy to chat about how we'll do it for all base end points in the app/repo.
Thanks for the review @saminegash, but what are you thoughts about the approach so far? |
I think I cannot say more as I am just looking into the codebases and diving in I believe. |
Your review and thoughts @kelvinkipruto |
@kilemensi I have gotten this to work, but it's hard to follow the code flow compared to the current page-based processing. For example, the |
Not sure if there is anything we can do about these sort of pages but any ideas are welcomed.
👍🏽
Yes, |
Taking this back to draft to focus on current PROD issues. |
Description
Our current implementation kinds of cheat: Looks at a page and processes all blocks that it knows will more or less be in a page. This PR flips that process: process all blocks in a given page without caring which page it is.
DO NOT MERGE: This PR is up to kick-start discussions and it's not ready to merge just yet. Pages that currently use block-based rendering include:
Type of change
Screenshots
N/A
Checklist: