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

Fix: ensure we can get fields from blocks and references #373

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

scottrippey
Copy link
Member

Addresses #369

The field(name) method normally allows deeply-nested fields, but ignores reference and block types.

This PR allows for deeply-nested fields for reference and block types when at the top-level.

Example:

q.fragment<Article>().project(sub => ({
  content: sub.field("content[]").project((txt) => ({
    children: txt.field("children[]"),
    markDefs: txt.field("markDefs[]"),
  })
});

Copy link

changeset-bot bot commented Apr 11, 2025

🦋 Changeset detected

Latest commit: 8d7c774

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

This PR includes changesets to release 2 packages
Name Type
groqd Patch
website Patch

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

Copy link

vercel bot commented Apr 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
groqd ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 9:45pm

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

packages/groqd/src/types/projection-paths.ts:21

  • [nitpick] The property keys in ProjectionPathShallowTypes (e.g. 'reference blocks') might be ambiguous. Consider using more descriptive and standardized key names (such as using camelCase or underscores) to improve clarity.
export interface ProjectionPathShallowTypes {

packages/groqd/src/types/projection-paths.ts:39

  • [nitpick] The renaming from 'IsShallowType' to 'IsSimpleType' may introduce ambiguity regarding the intended logic. Updating the type name or clarifying its purpose in documentation might help improve code clarity.
type IsSimpleType<Value> = IsAny<Value> extends true

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.

1 participant