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

Feature/change app structure #1063

Merged
merged 9 commits into from
Jun 10, 2024
Merged

Feature/change app structure #1063

merged 9 commits into from
Jun 10, 2024

Conversation

jesperengstrom
Copy link
Contributor

Description

Solves

Made an attempt at re-structuring the app (or really, reverting it to how it once was), mainly since (find)/+layout.server.ts has grown a bit out of hand and the search result really feels like it should be a component rather than a layout template. Also tried to gather the types and utils that were placed all over.

With this approach, we can begin to optimize the data fetching for the resource page, without worrying about breaking things on the /find route for example. The types that got lost in the resource load function are now back etc etc.

(On the downside, the load functions now have some duplicate logic. If this feels like a problem, we could maybe delegate it to an internal /find api route?)

Before:

(app)
   [[lang=lang]]
      (find)
         +layout.server.ts <-- data fetching
         +layout.svelte <-- search result
         find
            +page.svelte <-- basically nothing
         [[fnurgel=fnurgel]]
            +page.svelte <-- slot content

After:

(app)
   [[lang=lang]]
      find
         +page.server.ts <-- data fetching
         +page.svelte
            <SearchResult/>
      [[fnurgel=fnurgel]]
         +page.server.ts <-- data fetching
         +page.svelte
            <Stuff/>
            <SearchResult/>

Summary of changes

  • Change file structure, move files, fix imports.
  • Breakout <SearchResult> component
  • Move all types to $lib/types/[name].types.ts
  • Move some utils to $lib/utils
  • Remove some duplicate utils
  • Fix unit tests

@jesperengstrom jesperengstrom requested review from johanbissemattsson, olovy and lrosenstrom and removed request for olovy June 7, 2024 13:53
@jesperengstrom jesperengstrom changed the title Feature/change layout Feature/change app structure Jun 7, 2024
Camel-casing is used on the other types so changed this to keep it consistent
Copy link
Contributor

@johanbissemattsson johanbissemattsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work restructuring the load functions and fixing the types (and gathering all types in the $lib folder)! ⭐

It would be preferable to merge this soon to minimize the need to resolve merge conflicts (we’re currently working on relatively few simultaneous changes in the code base so it would fit very good timewise).

lxl-web/src/lib/types/api.types.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@olovy olovy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚢

@jesperengstrom jesperengstrom marked this pull request as ready for review June 10, 2024 13:30
@jesperengstrom jesperengstrom merged commit 638bd5a into develop Jun 10, 2024
@jesperengstrom jesperengstrom deleted the feature/change-layout branch June 10, 2024 14:02
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 this pull request may close these issues.

3 participants