Skip to content

fix: handle missing features in feed settings response#1025

Open
abdtriedcoding wants to merge 1 commit into
knocklabs:mainfrom
abdtriedcoding:fix/feed-settings-missing-features
Open

fix: handle missing features in feed settings response#1025
abdtriedcoding wants to merge 1 commit into
knocklabs:mainfrom
abdtriedcoding:fix/feed-settings-missing-features

Conversation

@abdtriedcoding

Copy link
Copy Markdown

Description

Fixes #1018

Users on flaky networks can receive a successful (200) response from the feed settings endpoint with a partial or empty body (e.g. missing the features object). The SDK then crashed with:

TypeError: can't access property "branding_required", v.features is undefined

This PR:

  • Normalizes feed settings in useFeedSettings so features.branding_required always defaults safely when missing
  • Adds optional chaining on features in both web and React Native NotificationFeed components
  • Adds a unit test for the partial-settings response case

Todos

None.

Checklist

  • Tests have been added for new features or major refactors to existing features.

Test plan

  • yarn testuseFeedSettings tests pass (including new partial response case)
  • yarn workspace @knocklabs/react-core type:check passes
  • yarn workspace @knocklabs/react-core lint passes
  • yarn workspace @knocklabs/react lint passes
  • yarn workspace @knocklabs/react-native lint passes

Normalize feed settings when the API returns a partial body (e.g. on flaky networks) and guard branding_required access in NotificationFeed components.

Fixes knocklabs#1018

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 089e177

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

This PR includes changesets to release 7 packages
Name Type
@knocklabs/react-core Patch
@knocklabs/react Patch
@knocklabs/react-native Patch
ms-teams-connect-example Patch
nextjs-app-dir-example Patch
slack-connect-example Patch
slack-kit-example 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

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@abdtriedcoding is attempting to deploy a commit to the Knock Team on Vercel.

A member of the Team first needs to authorize it.

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.

Users with bad internet: can't access property "branding_required", f.features is undefined

1 participant