Comments (4)
Hey @linkscope, thank you for opening an issue here! I think I understand the issue but would love to have some details on what you want this feature to look like.
As a workaround, I think you can define your secondary resource like below:
{
name: "vip",
identifier: "vipOrder", // So same resource name is inferred by the data provider
list: "/vip/order/:id", // To have it listed in the sider menu (I'll explain more on this below)
meta: { parent: "vip" },
}
This will make this page available in the menu, but :id
is required for your page and it will navigate you to a wrong page unfortunately.
We have hideOnMissingParameter
in useMenu
hook that powers the sider components but looks like we've missed this option to be configurable through props of <ThemedSiderV2 />
components.
If you swizzle the <ThemedSiderV2 />
component and set hideOnMissingParameter
to true
, it will be only visible when there's an :id
value present in the routes or meta
.
Let me list what we can do and maybe we can plan this for our next releases:
hideOnMissingParameter
should be configurable through props or Refine options but still, the default value should betrue
anyways, I think we can have this default value issue fixed in the next release- Even if there's no
list
value of a resource, it should still highlight the parents in the sider if it's the active route. - We're discussing on having the ability to define custom actions for a resource and make it work with menus, breadcrumbs etc. but this is not finalized yet so I cannot give an exact time or how it will work on this one.
For now, about the swizzle
workaround, you can swizzle the sider component and use it in your layout, then you can define a custom logic for your highlighted menu items. Or you can use the hideOnMissingParameter
prop like I've mentioned above.
Let us know if the features/fixes I've listed above works for you 🚀
from refine.
@aliemir Thanks for the detailed answer! I'll try to so if the change fixes the issue, in the same time I also hope that this swizzle
can be reflected in the documentation, I'm sure most admin have many non-CURD pages.
Also I'd like to be able to do this simply by configuring it entirely in resources
, e.g. just like this:
const resources = [
{
name: 'member',
list: '/member',
edit: '/member/edit/:id',
create: '/member/create',
recharge: '/member/recharge/:id' // non-CURD page
}
]
from refine.
@linkscope, I just want to have your opinion and feedback on this; what do you expect by defining a custom route in your resource definitions (in this case recharge
)? Having it work with menus, breadcrumbs and navigation hooks/buttons maybe? Do you have any other features in mind to work with this?
from refine.
@aliemir Thanks for your patience in listening! I would expect custom routes (in this case recharge
) to work with menus, breadcrumbs and navigation hooks, of course since it's a custom route the default headerButtons
can be eliminated, and it would be nice if the useDocumentTitle
doesn't need to be set separately, as I did in the previous question, this flow is fully consistent with CURD pages. I hope that the resources
configuration should not be limited to CURD, but can be more rich to configure the custom page, this experience is a bit similar to the vue
of the vue-router
operation process, for example, in this case I only need to add a line of code to achieve the functionality I expect, and at the same time, in the configuration This painless development process is great, and I hope the team will consider doing this if they can, and thanks for the work!
from refine.
Related Issues (20)
- [BUG] MUI Inferencer sets all fields to required HOT 1
- [BUG] Exmaple project cannot view HOT 3
- [BUG] nextjs 14 upgrade breaks imports HOT 4
- [FEAT]: Supabase Data Provider should filter array column by array HOT 5
- [FEAT] Support TypedDocumentNode for GraphQL data-provider HOT 6
- [BUG] Supabase token refresh not handled in Next.js example HOT 1
- [FEAT] Serving from a subdirectory HOT 2
- [DOC]: clarify rowCount retrieval and improve pagination examples
- [FEAT] i18n option when using cli to create project
- [BUG] After "npm create refine-app@latest" refine stucked in the build step forever HOT 2
- [BUG] Module '"@refinedev/antd"' has no exported member 'Create' ('List' and so on). HOT 1
- [BUG] npm create refine-app@latest fails with Found 58 errors in 12 files. HOT 2
- [BUG] Named export 'SyncOutlined' not found. HOT 16
- Date range table filter in Ant Design is broken HOT 11
- [BUG] Default GraphQL DataProvider GetListResponse from 'count' property not possible. HOT 2
- [FEAT] Default GraphQL DataProvider cannot function on deeper graphs HOT 2
- [BUG] Arrows directions in RTL (Right to Left) HOT 5
- [FEAT] Have an optional to reset from when close modal inside `useModalForm` HOT 4
- [FEAT] Ant Design's `<ThemedSiderV2>` change button position under mobile HOT 1
- Login is showing email not found for '[email protected]' being used in javascript mastery project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refine.