-
Notifications
You must be signed in to change notification settings - Fork 29
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
Issue with Excluding Specific Route from Predefined Layout (Flat Folders) #58
Comments
First of all, thanks for the kind words. I'm glad it has been helpful. As for the layout problem, that is indeed a limitation of the routing convention. The issue is that we're using the file system for both URL definition as well as nested layouts. So essentially, you're asking for the URL: One potential solution is to add support for a In the meantime, you could support this dynamically: // faculty+/_layout.tsx
export default function Component() {
const matches = useMatches()
const leaf = matches.at(-1)
// return <Outlet> only on login route
return leaf.id.endsWith('/login') ? <Outlet /> : <Layout />
}
function Layout() {
return // your original layout
} |
Hi @kiliman, I attempted to implement your suggestion and tried using For your reference, here is my const { flatRoutes } = require("remix-flat-routes");
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
cacheDirectory: "./node_modules/.cache/remix",
future: {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
ignoredRouteFiles: ["**/.*", "**/*.test.{js,jsx,ts,tsx}"],
postcss: true,
serverModuleFormat: "cjs",
tailwind: true,
routes: async (defineRoutes) => {
return flatRoutes("routes", defineRoutes);
},
}; And here's the revised route layout structure:
I would appreciate any further guidance or suggestions on how to address this. The goal is to have the Thank you for your help. |
Sorry if I wasn't clear.
When I said "add support", I meant it would require an update to the routing. That's why I gave you a workaround until the feature was implemented. |
BTW: In your remix.config file, the module.exports = {
ignoredRouteFiles: ["**/*"],
routes: async (defineRoutes) => {
return flatRoutes("routes", defineRoutes,
{ ignoredRouteFiles: ["**/.*", "**/*.test.{js,jsx,ts,tsx}"], }
);
},
}; |
Apologies for any confusion in our previous discussions. I sincerely appreciate your assistance thus far. In light of our discussions, I've decided to adopt a dynamic approach to handle this situation for the time being. Thanks again for your help and guidance. |
No problem. I'll try to get that added this weekend. |
This has been added to v0.5.10 |
Thank you for resolving the issue and adding the feature to the new update! Your efforts are greatly appreciated. |
Hi @kiliman ,
First of all, I want to commend you for your fantastic library, which has become an integral part of all my projects. However, I'm facing an issue that seems to be a limitation within the library itself.
The challenge is related to excluding a specific route (login) within a directory (faculty) from using its predefined layout route (_layout.tsx). Despite extensive attempts, including following all instructions outlined in the library's documentation, the issue persists. I do apologize if I've missed anything in the documentation.
I would like to add that creating a separate app/routes/faculty_.login.tsx isn't my desired solution. Instead, I'm interested in housing this within the existing faculty directory.
Here's my existing directory structure:
Considering the above, it appears that the library might lack a feature or mechanism to allow a specific route to bypass the predefined layout route. Could you please provide some guidance on this or consider it as a potential feature for a future update?
I look forward to your assistance in resolving this.
The text was updated successfully, but these errors were encountered: