Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Fragment Render Error with $ref is not defined #122

Open
@kenmintae

Description

@kenmintae

I'm having a bug with $fragmentRefs while trying to add a fragment container to QueryRenderer.

On my App.tsx I have a query like this:

const rootQuery = graphql`
    query AppQuery {
        data(
            marketInfo: {
                zipCode: [10001]
            }
        ) {
            ...MarketInfo_data
        }
    }
`

This is my codebase for MarketInfo.tsx:

const MarketInfo: React.FC<MarketInfoProps> = ({data}: MarketInfoProps) => {
    return (
        <Container>
            <InfoCard data={data} />
        </Container>
    )
}

export default createFragmentContainer(MarketInfo, {
    data: graphql`
        fragment MarketInfo_data on MarketData {
            id
            latestValue
            previousValue
            year
            change
        }
    `,
})

When I run relay compile, I got this bug: ReferenceError: _MarketInfo_data$ref is not defined.

I checked the ts file generated by Relay Compiler and everything looks fine:

declare const _MarketInfo_data$ref: unique symbol
export type MarketInfo_data$ref = typeof _MarketInfo_data$ref

I'm new to the whole Relay thing. Do you know what I can do to fix this bug? Thank you.

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