paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
683 stars 54 forks source link

when returning from update view, the previous table filter disappears #189

Closed gtolarc closed 3 years ago

gtolarc commented 3 years ago

When returning to the previous screen due to save/cancel in update view, it would be better to use back rather than push. The previous query is maintained only when back is used. (window.history.back();)

https://github.com/paljs/prisma-tools/blob/master/packages/admin/src/PrismaTable/EditRecord.tsx#L70 https://github.com/paljs/prisma-tools/blob/master/packages/admin/src/PrismaTable/EditRecord.tsx#L75 https://github.com/paljs/prisma-tools/blob/master/packages/admin/src/PrismaTable/dynamicTable.tsx#L135

In addition, it would be nice if the previous filters were restored as they were. It seems that the applied filters should be managed as state. Even if history back is used, only the filter caused by the query is preserved.

AhmedElywa commented 3 years ago

You can use these props to customize the button click https://paljs.com/prisma-admin#props

  // this event call when you click cancel button in create record modal
  onCancelCreate?: (options: { model: string; setCreateModal: (state: boolean) => void }) => void;
  // this event call when you click save button in create record modal
  onSaveCreate?: (options: {
    model: string;
    setCreateModal: (state: boolean) => void;
    refetchTable: (options?: any) => void;
  }) => void;
  // this event call when you click cancel button in edit record page
  onCancelUpdate?: (options: { model: string }) => void;
  // this event call when you click save button in edit record page
  onSaveUpdate?: (options: { model: string; refetchTable: (options?: any) => void }) => void;