Skip to content

Initialize plugins inside the headless hooks #6124

@Murderlon

Description

@Murderlon

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

It's a bit odd that when using headless hooks you still have to install the plugins on the Uppy instance:

new Uppy()
  .use(Tus, {
    endpoint: 'https://tusd.tusdemo.net/files/',
  })
  .use(UppyWebcam)
  .use(UppyScreenCapture)
  .use(UppyImageEditor)
  .use(UppyRemoteSources, { companionUrl: 'http://localhost:3020' })

but also initialize the hooks:

const editor = useImageEditor({ file: props.file })
const remoteSource = useRemoteSource(props.id)
const screenCapture = useScreenCapture({ onSubmit: props.close })
const webcam = useWebcam({ onSubmit: props.close })

Solution

Breaking change: initialize the plugin inside the hooks and pass all plugin options through the hook.

This gets rid of the unneeded duplication and off separation of initialization and configuration.

Alternatives

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.0For the 6.0 major releaseFeature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions