Resources not marking route as active

@kapa.ai why is it that why I navigate to creator-details list route, the campaigns in my dash menu doesnt show as active route?
<Route
path="/campaigns/details/creator/:id"
element={
<CreatorDetailsPage/>
}
/>
<Route
path="/campaigns/details/creator/:id"
element={
<CreatorDetailsPage/>
}
/>
export const resources: IResourceItem[] = [
{
name: "campaigns",
list: "/campaigns",
create: "/campaigns/create",
edit: "/campaign/sales/edit/:id",
show: "/campaigns/details/:id",
meta: {
label: "Campaigns",
icon: <ProjectOutlined />,
},
},
{
name: "campaign-details",
list: "/campaigns/details/:id",
create: "/campaigns/details/:id/create",
edit: "/campaign/sales/edit/:id",
meta: {
hide: true,
parent: "campaigns",
},
},
{
name: "creator-details",
list: "/campaigns/details/creator/:id",
create: "/campaigns/details/:id/create",
edit: "/campaign/sales/edit/:id",
meta: {
hide: true,
parent: "campaigns",
},
},
]
export const resources: IResourceItem[] = [
{
name: "campaigns",
list: "/campaigns",
create: "/campaigns/create",
edit: "/campaign/sales/edit/:id",
show: "/campaigns/details/:id",
meta: {
label: "Campaigns",
icon: <ProjectOutlined />,
},
},
{
name: "campaign-details",
list: "/campaigns/details/:id",
create: "/campaigns/details/:id/create",
edit: "/campaign/sales/edit/:id",
meta: {
hide: true,
parent: "campaigns",
},
},
{
name: "creator-details",
list: "/campaigns/details/creator/:id",
create: "/campaigns/details/:id/create",
edit: "/campaign/sales/edit/:id",
meta: {
hide: true,
parent: "campaigns",
},
},
]
K
kapa.ai127d ago
Hi @script4559. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The issue you're experiencing might be due to the way Refine handles active routes for resources. In Refine, the active route is determined by the list property of the resource. If the current route matches the list property of a resource, that resource is marked as active in the menu. In your case, the list property of your creator-details resource is set to "/campaigns/details/creator/:id". However, when you navigate to this route, the campaigns resource is not marked as active because its list property is set to "/campaigns", which doesn't match the current route. One way to solve this issue is to set the list property of your campaigns resource to a route that matches all the routes under it. For example, you could set it to "/campaigns/*". This way, any route that starts with "/campaigns" will mark the campaigns resource as active. Here's how you can do this:
export const resources: IResourceItem[] = [
{
name: "campaigns",
list: "/campaigns/*", // Change this line
create: "/campaigns/create",
edit: "/campaign/sales/edit/:id",
show: "/campaigns/details/:id",
meta: {
label: "Campaigns",
icon: <ProjectOutlined />,
},
},
// ... other resources ...
];
export const resources: IResourceItem[] = [
{
name: "campaigns",
list: "/campaigns/*", // Change this line
create: "/campaigns/create",
edit: "/campaign/sales/edit/:id",
show: "/campaigns/details/:id",
meta: {
label: "Campaigns",
icon: <ProjectOutlined />,
},
},
// ... other resources ...
];
Please note that this is a workaround and might not work in all cases. If this doesn't solve your issue, I recommend checking the Refine documentation (https://refine.dev/docs) or asking for help in the Refine Discord community (https://discord.com/channels/837692625737613362/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
K
kapa.ai127d ago
<@584066183989428345> kapa.ai is still learning and improving, please let us know how it did by reacting below
F
fair-rose127d ago
@kapa.ai it didnt work
K
kapa.ai127d ago
Let me check the knowledge base for you. One moment! :books: ---------------------- I'm sorry to hear that the suggested solution didn't work. Unfortunately, based on the information provided in the extracts, I don't have enough information to provide a more specific solution to your problem. Refine's routing and resource configuration can be complex, and issues like this can be caused by a variety of factors. It might be helpful to double-check your resource configuration and routing setup, and ensure that they're set up correctly according to the Refine documentation (https://refine.dev/docs). If you're still having trouble, I recommend reaching out to the Refine Discord community (https://discord.com/channels/837692625737613362/). The community is very active and you're likely to get help from other Refine users who may have encountered similar issues. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
K
kapa.ai127d ago
<@584066183989428345> kapa.ai is still learning and improving, please let us know how it did by reacting below
More Posts
on finish handler of refinr-hook-form giving create-property.tsx:34 TypeError: Cannot read properticreate-property.tsx:34 TypeError: Cannot read properties of undefined (reading 'toLowerCase') agetting this error Cannot read properties of undefined (reading 'email')TypeError: Cannot read propimport { useState } from "react"; import { useGetIdentity } from "@pankod/refine-core"; import { useCannot find module '@refinedev/core' or its corresponding type declarations.Cannot find module '@refinedev/core' or its corresponding type declarations.autocomplete option fetchin the autocomplete from refine, i ahve set useautocomplete to fetch the resouce data as options andHow to delete input field name with value before submitted formmy-json-data like this " "groupdetail": [ { "term_1": 11, "term_2": 5555, "terdev tools remove it from rerfine projecti dont want to see dev tools of refine visible on the projecthow can i define user to avoid the undefined user errorcreate-property.tsx:39 Uncaught (in promise) TypeError: Cannot read properties of undefined (readingetting this error in formcontrol Uncaught (in promise) TypeError: Cannot read properties of undefincreate-property.tsx:39 Uncaught (in promise) TypeError: Cannot read properties of undefined (readinHow does the DeleteButton work?How does the DeleteButton component work? and can I pass a custom function for it to run?How do I customize notificationprovider messages?For example, when I successfully edit a record, the toast message is "notifications.EditSuccess"What are the differences between the `useNotification` and `useHandleNotification` hooks?Id like to know more about each hook and what are their different uses and purposes.Get inserted ID after useCreate runsRefine + Supabase After I run useCreate(), the record inserts, but I am getting no data in the resgetting 404 error when i click on create property buttonthese are my files import {useState} from 'react' import { FieldValues, useForm } from '@pankod/regetting 404 error when clicked on create button on refine client dashboard page add propertygetting 404 error when clicked on create button on refine client dashboard page add propertyHow to implement husky , prettier and eslint in refineHow to implement husky , prettier and eslint in refineStop the api from calling multiple timesconst { data: customerDetails, error } = useCustom< CustomerSearchResponse, ApiErrorResponse