Skip to content

[@theme-ui/match-media] Breaks gatsby builds due to undefined window #438

@joestrouth1

Description

@joestrouth1

Using @theme-ui/match-media's useResponsiveValue hook in Gatsby causes the build to fail, due to its use of window.matchMedia.

I'd normally add a typeof window === 'undefined' check, but am not allowed to conditionally call a hook. Is there an alternative userland solution for this that I'm not thinking of?

I could add the check to the hook - is returning breakpoints[0] a sensible default?

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