Skip to content

addSourceMiddleware fails to register custom middleware for screen events #1211

@mwoods-familiaris

Description

@mwoods-familiaris

When using addSourceMiddleware, the middleware is only registered for certain event types. As such, whilst track and page events are successfully routed via custom registered middleware, the screen event type bypasses them entirely.

This appears to stem from the return for sourceMiddlewarePlugin which omits the screen event binding for the apply method, when it constructs the plugin object:

  return {
    name: `Source Middleware ${fn.name}`,
    type: 'before',
    version: '0.1.0',

    isLoaded: (): boolean => true,
    load: (ctx): Promise<Context> => Promise.resolve(ctx),

    track: apply,
    page: apply,
    identify: apply,
    alias: apply,
    group: apply,
  }

Is the omission of the screen binding here intentional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions