Skip to content
New issue

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

feat: add bail when we return a property from a function #260

Merged
merged 4 commits into from
Mar 11, 2024

Conversation

JoviDeCroock
Copy link
Member

Currently we see issues when a user does

const pokemon = useMemo(() => result.data.pokemons[0], [])

We could have built a workaround to know about memoization functions but that didn't seem like a good solution, instead we'll consider this our first "bail" scenario where we will mark the subtree of pokemons as used.

Copy link

changeset-bot bot commented Mar 8, 2024

🦋 Changeset detected

Latest commit: 0868d6c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@0no-co/graphqlsp Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -123,7 +124,8 @@ const crawlScope = (
originalWip: Array<string>,
allFields: Array<string>,
source: ts.SourceFile,
info: ts.server.PluginCreateInfo
info: ts.server.PluginCreateInfo,
inArrayMethod: boolean
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a bail when we are in one of our known array methods so we can still support cases like the following https://github.com/0no-co/GraphQLSP/blob/main/packages/example-tada/src/index.tsx#L47-L50

@JoviDeCroock JoviDeCroock requested a review from kitten March 8, 2024 13:38
@JoviDeCroock JoviDeCroock force-pushed the bail-for-function-return branch 3 times, most recently from 284ab88 to 0868d6c Compare March 11, 2024 10:53
@JoviDeCroock JoviDeCroock merged commit 39f573d into main Mar 11, 2024
1 check passed
@JoviDeCroock JoviDeCroock deleted the bail-for-function-return branch March 11, 2024 10:54
@github-actions github-actions bot mentioned this pull request Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants