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

Remove the SPA-like logic in the userland page and replace with proper routing #242

Closed
MaHaWo opened this issue Mar 17, 2025 · 3 comments · Fixed by #252
Closed

Remove the SPA-like logic in the userland page and replace with proper routing #242

MaHaWo opened this issue Mar 17, 2025 · 3 comments · Fixed by #252
Assignees

Comments

@MaHaWo
Copy link
Collaborator

MaHaWo commented Mar 17, 2025

  • have extra routes for the pages that are currently filled via the componentStore
@MaHaWo MaHaWo added this to the Initial production version milestone Mar 17, 2025
@jmsssc jmsssc self-assigned this Mar 19, 2025
@jmsssc
Copy link
Collaborator

jmsssc commented Mar 19, 2025

I made some good progress on this issue, have a more or less working proof of concept.

A few notes for myself mostly:
Currently the SPA approach sets the currentChild ID in a store, like the latest child that has been interacted with (and children gallery resets it to null). Sicne you can’t just go to a page this works well, it’ll never just have the latest child hanging around:
currentChild.id = child.id;
await currentChild.load_data();

However with page routing, if one loads the page or uses goto or to go to a page, that information will not be preserved. Particularly if one say favouried a page.

As compared to providing it as a part of the link:

/children/feedback vs
/children/feedback/1
(1 being the childs ID)

Idea: Easiest change is to use ID and pick it up from those new pages. Favourites will work, as will back buttons.

What does this mean? Populate currentChild.id to keep the same logic for processing and loading the child data which we know works well.
All links will need to change to include the relevant childs ID. To accomplish that, it should be sent alongside onClick I think or something.

Right now I put the logic from pages directly into /folder/path/folder --> +page.svelte files.
This means the pages all get named +page.svelte which I don't find all that great, but the code does live according to folders matching the purpose of the pages (so if things get big in a large project it's a bit more folder organised). I am more than happy to use redirects to the old named files if that's better, for now I will go ahead and edit the +page.svelte files to fix the various ways they need to use routing now. Back button already works and should work well with these routing dynamic changes.

Image

@lkeegan
Copy link
Member

lkeegan commented Mar 19, 2025

This sounds good to me, one minor thing while you're changing this: what about removing the /userLand prefix? And maybe simplifying a couple of routes, e.g. userLogin -> login, userLandingPage -> home, ..

@jmsssc
Copy link
Collaborator

jmsssc commented Mar 19, 2025

I have done that with userLandingPage.

I've actually kept userLand in my latest commits to use it for the logged-in-users-only sidebar config alongside routed pages, however, it could just as well be that the sidebar gets conditionally loaded on all pages

@MaHaWo MaHaWo linked a pull request Mar 20, 2025 that will close this issue
jmsssc added a commit that referenced this issue Mar 20, 2025
…icated #250, as part of #242 (user routing changes, so it makes sense to do this on top of the routing changes).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants