refine icon indicating copy to clipboard operation
refine copied to clipboard

[FEAT] Toggle off automatic real-time message publishing with Refine hooks on the client side

Open wyddiecurlin opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe.

Just a suggestion, there should be a way to shut off automatically publishing a message with hooks when using the live provider.

<Refine liveProvider={liveProvider(ablyClient)} .... />

Right now, useUpdate and many other supported hooks will automatically publish a message when triggered. Developers sometimes only publish messages on the server side and keep the client to only receiving those messages.

Describe alternatives you've considered

My workaround is to build a custom liveProvider in src/ folder, but it would be great if there is an option you can set under the <Refine> jsx.

Describe the thing to improve

const App: React.FC = () => {
    return (
        <Refine
            liveProvider={liveProvider}
            options={{ liveMode: "silent" }}

        />
    );
};

wyddiecurlin avatar Jul 09 '23 17:07 wyddiecurlin

Hello @wyddiecurlin thanks for the suggestion! We'll check it and get back to you soon.

BatuhanW avatar Jul 13 '23 08:07 BatuhanW

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 11 '23 10:09 stale[bot]

Hello @wyddiecurlin, as a workaround, if you want to disable publish globally, you do this:

liveProvider={{
   ...liveProvider(ablyClient),
   publish: undefined,
}}

Also we've discussed this issue internally and decided to go with an implementation looks like this:

  • Accept liveModePublish: "on" | "off" option to refine options. Default value should be "on".
  • Also acceptd liveModePublish parameter for useCreate, useCreateMany useUpdate, useUpdateMany, useDelete, useDeleteMany, useForm hooks.
  • useForm hook should pass this liveModePublish value to mutation hooks (useCreate, useUpdate etc..)

By default, refine.options.liveModePublish is on state.

These hooks, check for incoming liveModePublish parameter and respect it.

If hook doesn't have this parameter, it should respect the value in refine options.

We are accepting contributions for this issue!

BatuhanW avatar Oct 02 '23 09:10 BatuhanW

Thanks!

wyddiecurlin avatar Oct 05 '23 00:10 wyddiecurlin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 20 '24 10:01 stale[bot]