refine
refine copied to clipboard
[FEAT] Toggle off automatic real-time message publishing with Refine hooks on the client side
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" }}
/>
);
};
Hello @wyddiecurlin thanks for the suggestion! We'll check it and get back to you soon.
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.
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
liveModePublishparameter foruseCreate,useCreateManyuseUpdate,useUpdateMany,useDelete,useDeleteMany,useFormhooks. useFormhook should pass thisliveModePublishvalue 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!
Thanks!
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.