Skip to content

docs(KNO-14128): document KnockProvider enabled prop and useKnockAuthState - #1536

Merged
kylemcd merged 6 commits into
mainfrom
kyle-kno-14128-document-the-knockprovider-enabled-prop-on-the-docs-site
Jul 15, 2026
Merged

docs(KNO-14128): document KnockProvider enabled prop and useKnockAuthState#1536
kylemcd merged 6 commits into
mainfrom
kyle-kno-14128-document-the-knockprovider-enabled-prop-on-the-docs-site

Conversation

@kylemcd

@kylemcd kylemcd commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

Documents the new enabled prop on KnockProvider and the useKnockAuthState hook, shipped in the stable SDK release (KNO-14095 / knocklabs/javascript#1033, promoted to stable in #1038). The copy is adapted from the package READMEs updated in that work (packages/react, packages/react-native, packages/expo, packages/client).

What's documented

  • enabled prop on KnockProvider. When false, children still render but the Knock client stays idle — no identify call, no API requests, and no websocket. Flipping to true behaves like a login; flipping to false behaves like a logout. Defaults to true. The recommended way to gate the provider on a complete identity (async user token, feature flags, gated workspaces, cookie consent) rather than mounting and unmounting the provider.
  • useKnockAuthState() hook. Subscribable auth state (status, userId, userToken) for reacting to login, logout, and user switches.
  • Behavior notes. Feeds remount and reload when enabled flips to true; Slack and Microsoft Teams connection status re-checks when the authenticated user changes; Expo autoRegister waits until the client is authenticated (the OS permission prompt is deferred, not skipped); and for guides, enabled gates the whole client while readyToTarget still gates guide targeting on its own.

Files changed

  • typedocs/react-core/components/knock-provider.mdxenabled prop + "Deferring activity" section with behavior notes.
  • typedocs/react-core/hooks/use-authenticated-knock-client.mdxenabled option for headless clients.
  • typedocs/react-core/hooks/use-knock-auth-state.mdx + content/in-app-ui/react/sdk/hooks/use-knock-auth-state.mdx + data/sidebars/inAppSidebar.ts — new useKnockAuthState hook page and sidebar entry.
  • content/in-app-ui/react-native/sdk/reference.mdx and content/in-app-ui/expo/sdk/reference.mdxenabled prop on KnockProvider and a useKnockAuthState hook section (Expo also notes the autoRegister deferral).

Todos

  • Hold for the stable (non-RC) SDK release before merging — shipped 2026-07-14.
  • Confirm the shipped versions: @knocklabs/react@0.12.0, @knocklabs/react-core@0.14.0, @knocklabs/client@0.22.0, @knocklabs/react-native@0.10.0, @knocklabs/expo@0.7.0 — verified against main.

All documented API surface (prop, option, hook signature, KnockAuthState types, package exports, Expo autoRegister auth-gating) verified against knocklabs/javascript@main post-stable-release.

Tasks

KNO-14128

…State

Adds documentation for the new enabled prop on KnockProvider (React, React
Native, Expo) and the useKnockAuthState hook, adapted from the package READMEs
in knocklabs/javascript#1033.

- React KnockProvider typedoc: enabled prop + behavior notes (feed remount,
  Slack/Teams re-check, guides readyToTarget distinction)
- useAuthenticatedKnockClient typedoc: enabled option
- New useKnockAuthState hook typedoc, content page, and sidebar entry
- React Native and Expo references: enabled prop + useKnockAuthState hook
- Expo: note that autoRegister defers push registration until authenticated
@linear-code

linear-code Bot commented Jul 10, 2026

Copy link
Copy Markdown

KNO-14128

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 15, 2026 4:04pm

Request Review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4650cde. Configure here.

Comment thread typedocs/react-core/hooks/use-knock-auth-state.mdx Outdated
Trim filler adverbs (currently, directly) and reword the deferring-activity
sentence to drop 'asynchronously'/'conditionally' per the style guide's
avoid-adverbs rule.
Addresses comment by @cursor (BugBot): the same KnockProvider reference
page was linked twice on one page; later mentions should be plain text.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk MEDIUM: Documents the new KnockProvider enabled prop and useKnockAuthState hook across React, React Native, and Expo SDK reference pages, adding a new content page and sidebar entry.

Reasons

  • A new MDX page is added in /content/ (content/in-app-ui/react/sdk/hooks/use-knock-auth-state.mdx), triggering the new-page rule
  • Sidebar navigation file is modified (data/sidebars/inAppSidebar.ts) to add the new hook entry
  • A new typedoc file is added (typedocs/react-core/hooks/use-knock-auth-state.mdx) with 55 lines of documentation
  • Changes span 7 files with 235 additions, adding documentation consistently across three SDK reference pages
  • No HIGH risk triggers: no code in components/, layouts/, lib/, or styles/ is modified; no package.json, yarn.lock, or build config changes

Notes

  • Verify the new sidebar entry for useKnockAuthState renders correctly and appears in the expected position among the React hooks
  • Check that the new use-knock-auth-state.mdx content page loads via the <Typedoc> component without errors
  • Confirm cross-links between the enabled prop documentation and useKnockAuthState hook resolve correctly across all three SDK pages (React, React Native, Expo)
Open in Web View Automation 

Sent by Cursor Automation: Docs PR classifier

Comment thread content/in-app-ui/expo/sdk/reference.mdx Outdated
Comment thread content/in-app-ui/expo/sdk/reference.mdx Outdated
Comment thread content/in-app-ui/expo/sdk/reference.mdx
Comment thread content/in-app-ui/react-native/sdk/reference.mdx
Comment thread typedocs/react-core/hooks/use-knock-auth-state.mdx
- Expo push-registration note: reword to avoid the app-login metaphor and
  drop the parenthetical
- Expo autoRegister: drop the 'logged-out' qualifier
- KnockAuthState attribute descriptions: 'signed in' -> 'authenticated'
  (React typedoc, React Native, Expo)
Follow-up to @cellomatt's review: apply the authentication-centric wording
consistently. Reword the enabled prop descriptions, deferring-activity prose,
and the useAuthenticatedKnockClient option away from 'like a login/logout',
harmonize the Expo autoRegister note to 'client authentication completes', and
align the useKnockAuthState copy ('authenticated user changes').
Matches the 'unauthenticated/authenticated' terminology used elsewhere in
the doc and avoids the login-metaphor ambiguity flagged in review, even
though this was example UI copy rather than doc prose.
@kylemcd
kylemcd merged commit 96823a4 into main Jul 15, 2026
5 checks passed
@kylemcd
kylemcd deleted the kyle-kno-14128-document-the-knockprovider-enabled-prop-on-the-docs-site branch July 15, 2026 16:10
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