We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When you have a component that takes a list, and you have logic that filters the list, the fields are incorrectly flagged as unused.
Here is a code example.
export interface CabinImageCarouselProps { images: Array<FragmentOf<typeof cabinImageCarouselCabinImageFragment>>; } export const cabinImageCarouselCabinImageFragment = graphql(` fragment CabinImageCarousel_CabinImage on CabinImage { altText imageDimensionCode url } `); export const CabinImageCarousel: React.FC<CabinImageCarouselProps> = ( props ) => { const images = readFragment( cabinImageCarouselCabinImageFragment, props.images ); const seatImages = useMemo<Array<CarouselImage>>(() => { return ( images .filter((i) => i.imageDimensionCode === ImageDimensionCode["300x500"]) .map((p) => ({ url: p.url, alt: p.altText, })) ?? [] ); }, [images]); return <ImageCarousel images={seatImages} />; };
In this case, altText and url are flagged as unused.
altText
url
If I remove the filter, they are no longer flagged as unused.
No response
gql.tada v1.8.6
The text was updated successfully, but these errors were encountered:
I am assuming we are missing a case for chained methods over here as it correctly picks up the accessor from filter but not from map
filter
map
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
When you have a component that takes a list, and you have logic that filters the list, the fields are incorrectly flagged as unused.
Here is a code example.
In this case,
altText
andurl
are flagged as unused.If I remove the filter, they are no longer flagged as unused.
Reproduction
No response
gql.tada version
gql.tada v1.8.6
Validations
The text was updated successfully, but these errors were encountered: