Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

[docs] add note to docs "_app cannot be overwritten" #76

Closed
gabrielromk opened this issue Jan 12, 2024 · 6 comments
Closed

[docs] add note to docs "_app cannot be overwritten" #76

gabrielromk opened this issue Jan 12, 2024 · 6 comments
Assignees
Labels
priority: high Do next (schedule it?)

Comments

@gabrielromk
Copy link
Contributor

During the migration of the company handbook to the Netzo framework, I faced challenges with the application layout. Despite having all the necessary files installed, including netzo.ts, .env, etc., none of the functionalities were working as expected. After thorough investigation, I identified the problem to be associated with conflicting middleware in the _app.ts file. This middleware was overriding all Netzo configurations. Upon removing the conflicting middleware, Netzo became operational, resolving the issues encountered during the migration process.

with _app.ts
Screenshot 2024-01-11 10 32 16 PM

without _app.tsx
Screenshot 2024-01-11 10 34 43 PM

@gabrielromk gabrielromk added the priority: high Do next (schedule it?) label Jan 12, 2024
@miguelrk
Copy link
Contributor

Good catch. Indeed, the netzo layout plugin injects a default _app.tsx so user can no longer use a custom _app.tsx without running into issues. This is due to how fresh works, and if a solution comes, it should come upstream from fresh. Be reminded that you can always use _layout.tsx files (one per file level) which will render under the auto-injected _app.tsx.

Keeping this open for now, so that we can add a note to the docs and avoid confusion for users.

@miguelrk miguelrk changed the title [framework] middleware (_app.tsx) conflict preventing netzo framework integration [docs] add note stating _app.tsx cannot be overwritten (can use _layout.tsx) Jan 16, 2024
@miguelrk miguelrk added this to the 01.2024 milestone Jan 16, 2024
@deer
Copy link
Contributor

deer commented Jan 21, 2024

Hola chicos, I contribute a lot to fresh, specifically around plugins. What sort of solution are you looking for here? I don't see an easy way of combing an _app.tsx file from a plugin (or even from multiple plugins!) with one from the user's code. If you could elaborate on what you're looking for, that would be great.

@miguelrk
Copy link
Contributor

miguelrk commented Jan 21, 2024

Hola @deer! Thanks for your interest!

I agree, there might be no natural way of combining plugin-injected and user-defined _app files, and that's ok. Regarding this, I would prefer the current behavior of max 1 _app file, whether injected or not, in favor of simplifying the mental model when using fresh. That being said, adding a warning whenever fresh detects the presence of 2 or more _app files (from plugins and/or from user code) would be great. Same goes for _layout files, with the difference these are scoped at the route-level, rather than global like _app.

@miguelrk miguelrk changed the title [docs] add note stating _app.tsx cannot be overwritten (can use _layout.tsx) [docs] add note to docs "_app cannot be "overwritten" Jan 21, 2024
@miguelrk miguelrk changed the title [docs] add note to docs "_app cannot be "overwritten" [docs] add note to docs "_app cannot be overwritten" Jan 21, 2024
@deer
Copy link
Contributor

deer commented Jan 21, 2024

Ok, it seems like the right solution is to dust off denoland/fresh#1568 and finally get that merged. I'll keep any discussions of implementation details there (or more likely in the new PR that I might open), but I guess this would solve your problem.

@miguelrk
Copy link
Contributor

Thanks for the pointer! Wasn't aware of denoland/fresh#1568, that covers not only this warning but many more! That's great news. Let's keep the discussion over there 👍🏼

@miguelrk miguelrk removed this from the 01.2024 milestone Feb 8, 2024
@miguelrk
Copy link
Contributor

miguelrk commented Feb 8, 2024

Closing as netzo no longer auto-injects an _app file via plugin in favor of explicitly having an _app.tsx in the template. So this issue has been solved.

@miguelrk miguelrk closed this as completed Feb 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: high Do next (schedule it?)
Projects
None yet
Development

No branches or pull requests

3 participants