Skip to content

Uncaught errors when adobeDataLayer exists but getState() is not yet available #176

Description

@btripple

Note: this is an issue in the gcoe-adobe-client-data-layer Launch extension, not in Adobe's core adobe-client-data-layer open-source library. The core library's documented pattern already handles this correctly; this extension's bundled data element module does not.

Expected behavior: The "Data Layer Computed State" data element should safely return undefined (or defer) when the Adobe Client Data Layer library hasn't finished upgrading window.adobeDataLayer from its initial stub array into the full instance, instead of throwing an error.

Actual behavior: A data element using this module throws TypeError: t.getState is not a function when it evaluates before the ACDL library has finished initializing.

In my scenario: I was using a clean container very light in rules and file size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions