Closed acekyd closed 10 months ago
Okay... so, a profile can be tied to a project's owner?
Yes and also hopefully make the website faster. And if someone goes to a direct link without going to the projects page, the data is also available. @kaf-lamed-beyt
Oh okay. makes sense now.
I thought of an approach — two actually — of accomplishing this. The first involves using a Zustand store to persist the project's data.
The second encompasses the use of a shareable hook — perhaps, useProjects()
— which would encapsulate the getData
and convertToJSON()
functions. So we'd just call the hook wherever we need it in the project.
Thinking of it again now, I think it'd be better if we go with the store approach as it'd prevent us from fetching data over and over again wherever the hook is used in a component. We fetch the project data once from GitHub and populate the store with it.
Any time we want anything from the store, we go there. Let me know how this sounds @acekyd.
Yes I like the sound of the universal store so we can reuse the data anyhow we please. @kaf-lamed-beyt
Awesome! I'll try something out during the week and let you know how it goes.
What questions do you have about this? @kaf-lamed-beyt
Okay... say we keep all the projects in a store, yeah?
This will enable building components that could use the data in a user's profile on the blog for example.
What's the relationship between those projects and the creators? Say, on the creators route for instance
@kaf-lamed-beyt So the main goal is this - whichever page serves as the entry point for a user - could be a blog page, could be the about page, I'd want to load the projects in the background (and one time) so that wherever they navigate to after that is smoother.
As regards the interoperability of the data with components / pages - for the creators, the routes would be their username e.g /creators/acekyd. And in that markdown, we can show projects that match their username. Or on the landing page we can randomly or manually select featured projects without having to run a http request.
Not all of these features are currently available or will be on launch, but good to think of the data fetching with that in mind.
Aha! I see. Now I understand. I'll refactor the current store approach. If anything changes I'll let you know.
Resolved in #272
I don't use much Next but I currently fetch projects only on the Projects page however would love to do this in a way that makes the data available across state in the website.
This will enable building components that could use the data in a user's profile on the blog for example.
Open to recommendations or a PR.
Current implementation can be found in Projects