refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] Clone doesn't seems to be work as an action

Open yeochinyi opened this issue 1 year ago • 4 comments

Describe the bug

<CloneButton {...uiDefaults.buttonProps} recordItemId={props.id} /> Added a clonebutton but clicking it returns 404

Steps To Reproduce

Added a clonebutton but clicking it returns 404

Expected behavior

Should clone like edit but creates a new item when save

Packages

  • @refinedev+react-router-v6 version 4.5.5

Additional Context

I think the issue is in here. https://github.com/refinedev/refine/blob/master/packages/react-router-v6/src/create-resource-routes.tsx#L59 Add a "clone" to this array.... (["list", "show", "edit", "create"] as const).forEach((action) => { And removing this...... if (action === "create") { actions.push({ action: "clone", element: element, path, }); }

yeochinyi avatar Feb 13 '24 03:02 yeochinyi

Hey @yeochinyi did you add clone path to your resources and correct route?

BatuhanW avatar Feb 13 '24 07:02 BatuhanW

I didn't specifed any custom routing and opted for resource routing for all 'show,create,edit,delete, clone'. i.e. const resources = [ { name: "coaches", list: CoachList, create: CoachCreate, edit: CoachEdit, clone: CoachClone, show: CoachShow, meta: { canDelete: true, icon: <UserAddOutlined />, }, }, The default routing routes to this URL "https:///coaches/clone/1" which cannot find the React "CoachClone" fn. All routing works as expected except "clone"

Any docs on how to resolve the issue ? the clone docs is a bit lacking..

yeochinyi avatar Feb 13 '24 08:02 yeochinyi

Hello @yeochinyi, are you using Refine@v3? If you provide us npm run refine whoami it would be awesome.

alicanerdurmaz avatar Feb 15 '24 07:02 alicanerdurmaz

   pnpm run refine whoami

[email protected] refine /Users/christopheryeo/workspace/run/procoach/procoach-refine refine "whoami"

System:

  • OS: macOS 14.2.1
  • CPU: (10) arm64 Apple M2 Pro

Binaries:

  • Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
  • Yarn: Not Found
  • npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm

Browsers:

  • Chrome: 121.0.6167.184
  • Safari: 17.2.1

Refine Packages:

  • @refinedev/antd: 5.37.4
  • @refinedev/cli: 2.16.24
  • @refinedev/core: 4.47.1
  • @refinedev/devtools-internal: 1.1.5
  • @refinedev/devtools-server: 1.1.24
  • @refinedev/devtools-shared: 1.1.3
  • @refinedev/devtools-ui: 1.1.17
  • @refinedev/devtools: 1.1.32
  • @refinedev/inferencer: 4.5.20
  • @refinedev/kbar: 1.3.6
  • @refinedev/nestjs-query: 1.1.1
  • @refinedev/react-router-v6: 4.5.5
  • @refinedev/supabase: 5.7.6
  • @refinedev/ui-types: 1.22.4

yeochinyi avatar Feb 17 '24 04:02 yeochinyi

@yeochinyi I couldn't reproduce the issue, you can find an example here

Did you add your "clone" page to your routes? If you provide a reproducible example, I will be happy to debug

alicanerdurmaz avatar Feb 20 '24 09:02 alicanerdurmaz