useUpdateDispatcherConfig is a React Hook that lets you update a dispatcher configuration on the Profile you own.


Reduce signing hassle

Enabling the dispatcher let's you deliver better UX to your users by removing the need for singing on the most common Lens operations.

As of now, the dispatcher works for post, comment, mirror, updating profile metadata and updating profile image.

Read more about dispatcher in our API docs:

const { update, error, isPending } = useUpdateDispatcherConfig({ profile });


Call the update method from your event handler (quite likely attached to some button).


Remember to gracefully handle errors

Don't just ignore the error returned from the useUpdateDispatcherConfig hook. These are a valid scenarios that can happen to your user while using your app.

import {
} from '@lens-protocol/react-web';

type UpdateDispatcherConfigButtonProps = {
  profile: ProfileFragment;

function UpdateDispatcherConfigButton({ profile }: UpdateDispatcherConfigButtonProps) {
  const [isEnabled, setIsEnabled] = useState(profile.dispatcher !== null);
  const { update, error, isPending } = useUpdateDispatcherConfig({ profile });

  const submit = async (e: React.FormEvent<HTMLFormElement>) => {

    await update({ enabled: isEnabled });

  return (
    <form onSubmit={submit}>
          <label htmlFor="isEnabled">Is dispatcher enabled</label>
            onChange={() => setIsEnabled((current) => !current)}

        <button type="submit" disabled={isPending}>

        {error && <p>{error.message}</p>}



Call useUpdateDispatcherConfig in the component responsible to update dispatcher configuration.

function UpdateDispatcherConfigForm({ profile }) {
  const { update, error, isPending } = useUpdateDispatcherConfig({ profile });
  // ...


  • profile This is the author profile of the new comment. It must be a profile owned by the authenticated Signer (see useWalletLogin). You can retrieve the currently active profile via the useActiveProfile hook.


Returns an object with:

  • update: a function you can use to initiate the update of the dispatcher configuration.
  • isPending: a boolean notifying you when the operation is still in progress.
  • πŸ“˜

    Important to know

    isPending flag for useUpdateDispatcherConfig behaves differently from other hook.

    We always try to be very optimistic about the response which works good for creating publications, mirroring, following but updating dispatcher config is different in that case.

    Given that dispatcher configuration affects how all new transactions are processed the useUpdateDispatcherConfig isPending flag waits until the transaction was mined and processed by backend.

  • error: any error that might occur in normal operating conditions will be returned via this property.

update function

You can use the update function to initiate the process that leads to a new comment.


It accepts a simple object with just enabled key that should flag if the dispatcher should be enabled or disabled.

  enabled: boolean


It returns a Promise<void> that you can use to sync with the state of your component. For example, you can clear the content of any text input field when such Promise resolves.