Skip to content

The method valueOf() of a Drop does not await promises #948

Description

@thomas-jakemeyn

Use Case

I put an object on the scope of the template - let's call it o - and I would like to make it super easy for template authors to serialize it to a string representation. What I have in mind is to call my serialization function from the method valueOf() of my Drop, which would provide the following authoring experience:

# Returns the identifier of the object
{{ o.id }}

# Returns a string representation of the object
{{ o }}

Problem

The problem is that my serialization function is async and, instead of getting the string representation, I get [object Promise]. That behavior is different than e.g. liquidMethodMissing() that awaits promises.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions