Skip to content

feat(navigation): add featuredLinksSet and orderedSetID; add orderedSetID to createFeaturedLink#7499

Merged
nickskalkin merged 5 commits intomainfrom
nickskalkin/navigation-visual-component
Mar 17, 2026
Merged

feat(navigation): add featuredLinksSet and orderedSetID; add orderedSetID to createFeaturedLink#7499
nickskalkin merged 5 commits intomainfrom
nickskalkin/navigation-visual-component

Conversation

@nickskalkin
Copy link
Copy Markdown
Contributor

@nickskalkin nickskalkin commented Mar 5, 2026

Adds support for managing navigation visual components from Forque.

NavigationVersion:

  • Adds an orderedSetID field
  • Adds a featuredLinksSet field that resolves a list of FeaturedLink entries associated with the navigation version’s ordered_set_id

Example:

{
  navigationVersion(groupID: "whats-new") {
    featuredLinksSet {
      title
      subtitle
      image {
        url
      }
    }
  }
}

Response:

{
  "data": {
    "navigationVersion": {
      "featuredLinksSet": [
        {
          "title": "Inside Michael Sherman’s Collection",
          "subtitle": "Collector Spotlight",
          "image": {
            "url": "https://d32dm0rphc51dk.cloudfront.net/b4VmSpAIXNEbaclTjmY3uw/large_rectangle.jpg"
          }
        }
      ]
    }
  }
}

CreateFeaturedLink mutation:

  • Adds an optional orderedSetID argument to createFeaturedLink input.
  • When orderedSetID is provided, the mutation now creates the featured link and adds the created link to the specified ordered set

…etID to createFeaturedLink

- NavigationVersion: featuredLinksSet, orderedSetID
- createFeaturedLink: optional orderedSetID to add new link to an ordered set
@nickskalkin nickskalkin requested a review from dblandin March 13, 2026 08:31
@nickskalkin nickskalkin marked this pull request as ready for review March 13, 2026 08:31
Comment thread src/schema/v2/Navigation/NavigationVersion.ts
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
@github-actions github-actions Bot deleted a comment from claude Bot Mar 13, 2026
Comment thread src/schema/v2/Navigation/NavigationVersion.ts
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
@github-actions github-actions Bot deleted a comment from claude Bot Mar 13, 2026
Comment thread src/schema/v2/FeaturedLink/createFeaturedLinkMutation.ts
@github-actions github-actions Bot deleted a comment from claude Bot Mar 13, 2026
Comment thread src/schema/v2/FeaturedLink/createFeaturedLinkMutation.ts
@github-actions github-actions Bot deleted a comment from claude Bot Mar 13, 2026
Comment on lines +101 to +109
if (args.orderedSetID) {
if (!addSetItemLoader) {
throw new Error("addSetItemLoader is not defined")
}

await addSetItemLoader(args.orderedSetID, {
item_id: featuredLink.id,
})
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Non-atomic two-step operation: If addSetItemLoader fails after the featured link is already created, the featured link will exist as an orphan (created but not added to the ordered set). The catch block will format this as a GravityMutationError or re-throw, making it look like the entire operation failed — but the link was actually created.

This may be acceptable given the architecture, but worth considering whether the caller needs to know about this partial-failure state (e.g., returning the created link's ID even on set-addition failure so it can be cleaned up or retried).

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 13, 2026

Code Review

Summary

This PR adds support for associating featured links with ordered sets via a new orderedSetID parameter on the createFeaturedLink mutation, and exposes a featuredLinksSet field (plus orderedSetID) on NavigationVersion to read them back. This enables navigation versions to have visual components backed by featured links in ordered sets.

Issues Found

  • 🟡 Important: Non-atomic two-step mutation in createFeaturedLinkMutation.ts (lines 99–109) — the featured link is created first, then added to the ordered set. If the second call fails, an orphaned featured link exists but the error response makes it look like nothing was created. Left an inline comment with details.

Areas Reviewed

  • Architecture & Design: Clean separation — mutation handles the write side, NavigationVersion handles the read side via setItemsLoader. The orderedSetID field on NavigationVersion is a nice addition for admin tooling.
  • Security: No concerns. Authorization is delegated to backend loaders as expected.
  • Bugs & Edge Cases: The featuredLinksSet resolver correctly returns null when ordered_set_id is absent. The setItemsLoader is available in both authenticated and unauthenticated contexts (confirmed via loader definitions), so this won't blow up for public queries.
  • Testing: Good coverage — tests cover the happy path for both mutation and query sides, the addSetItemLoader missing case, and the empty set case. One minor gap: no test for featuredLinksSet when ordered_set_id is null/undefined on the navigation version (though the code path is straightforward).

Overall this is a clean, well-structured PR. The non-atomic mutation concern is the only notable item, and it may be acceptable given the system's architecture.

🤖 Generated with Claude Code

Copy link
Copy Markdown
Member

@dblandin dblandin left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

@nickskalkin nickskalkin merged commit 445a703 into main Mar 17, 2026
8 checks passed
@nickskalkin nickskalkin deleted the nickskalkin/navigation-visual-component branch March 17, 2026 07:18
...InternalIDFields,
createdAt: date(({ created_at }) => created_at, true),
featuredLinksSet: {
type: new GraphQLList(FeaturedLinkType),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I missed this earlier but we should be able to make this a non-nullable list with non-nullable FeaturedLinkType entries.

That should reduce the amount of null checks needed in Force.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: Also: since we're no longer returning a Set type here - should we drop the Set suffix? Maybe just featuredLinks?

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