Skip to content

Crash when calling Map/Set methods saved in a content collection entry #16682

@demaisj

Description

@demaisj

Astro Info

Astro                    v6.3.1
Node                     v22.22.0
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When calling methods from a Map or Set object saved in a collection entry (for example via zod transforms), the following error occurs:

method called on incompatible Object

Calling methods on a Date object works.

I initially thought it could be related to devalue serialization but this test code doesn't crash

import * as devalue from 'devalue'
const from = new Set(['value']);
const store = devalue.stringify(from);
const to = devalue.parse(store)
console.log(from, store, to)
to.has('value')

What's the expected result?

Calling methods on Set or Map objects should work just like Dates.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-3wrzjyiz?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions