fix(typegen): handle duplicate type names#8950
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
Contributor
|
No changes to documentation |
Contributor
⚡️ Editor Performance ReportUpdated Mon, 07 Apr 2025 12:45:45 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
a70e591 to
9dec78e
Compare
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
9dec78e to
14f29b4
Compare
14f29b4 to
57c7bb7
Compare
748c20d to
c346b1c
Compare
d956aaf to
77c7346
Compare
Contributor
📊 Playwright Test ReportThis report contains test results, including videos of failing tests. |
Member
Author
|
Had to rebase so also had to re-request review @stipsan sorry about that |
stipsan
approved these changes
Apr 8, 2025
kbrabrand
added a commit
that referenced
this pull request
Nov 28, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
kbrabrand
added a commit
that referenced
this pull request
Dec 3, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
kbrabrand
added a commit
that referenced
this pull request
Dec 3, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
kbrabrand
added a commit
that referenced
this pull request
Dec 5, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 9, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 10, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 12, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 15, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 15, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 15, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
kbrabrand
added a commit
that referenced
this pull request
Dec 16, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
kbrabrand
added a commit
that referenced
this pull request
Dec 16, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
kbrabrand
added a commit
that referenced
this pull request
Dec 16, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 16, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
bjoerge
pushed a commit
that referenced
this pull request
Dec 16, 2025
…ing (#10294) The TypeGenerator class has been refactored. Logic specific to generating TypeScript types from the Sanity schema has been extracted into a new, focused SchemaTypeGenerator class. This serves as read-only unit that encapsulates the collection of schema types and pre-computes identifiers and inline types (preserve the behavior of fix(typegen): handle duplicate type names #8950) Memoization: To prevent re-running costly operations when inputs haven't changed (a common scenario in watch mode), memoization has been implemented for expensive computations. This uses reselect's createSelector, a custom computeOnce helper, and a weakMapMemo helper for the evaluateQuery method. Note: There is no watch mode yet. This is in preparation. Improved CLI Reporting: The typegen generate command now includes a percentage of completion. This is facilitated by @sanity/worker-channels. Co-authored-by: Kristoffer Brabrand <kristoffer@brabrand.no>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We require each query to be unique, but we normalize the schema type names. Ie
foo.barbecomesFooBar, if you then also have another typefooBarthat would also becomeFooBar. This change ensures that we properly increment the suffixWhat to review
Did I miss anything?
Testing
Added
Notes for release
TypeGen: Fixes a rare bug where generated type names could collide and wasn't handled correctly.