Releases: knocklabs/javascript
Release list
@knocklabs/react@0.12.0
Minor Changes
-
e8567eb: Add an
enabledprop toKnockProvider(and anenabledoption touseAuthenticatedKnockClient).When
enabledisfalse, the provider still renders its children but the Knock client sits idle: no identify call, no API requests, no websocket. Set it totrueand it connects like a login; set it back tofalseand it disconnects and clears its data like a logout. It defaults totrue, so existing code is unaffected.Use this instead of conditionally mounting
KnockProvider, for example to wait for a user token that loads asynchronously:<KnockProvider apiKey={apiKey} user={{ id: userId }} userToken={userToken} enabled={Boolean(userId && userToken)} />
Also fixed:
useFeedSettingsno longer callsGET /v1/users/undefined/feeds/.../settingswhen there's no user.KnockProvidernow disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.
-
e8567eb: Add
useKnockAuthState()and make Slack, MS Teams, and Expo respond to sign-in changes.- New
useKnockAuthState(knock)hook re-renders when the user signs in, signs out, or switches. - Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
- Expo waits for a signed-in user before registering for push notifications, so logged-out users don't see the OS permission prompt. A notification tapped while logged out no longer tries to update its status.
- New
Patch Changes
@knocklabs/react-native@0.10.0
Minor Changes
-
e8567eb: Add an
enabledprop toKnockProvider(and anenabledoption touseAuthenticatedKnockClient).When
enabledisfalse, the provider still renders its children but the Knock client sits idle: no identify call, no API requests, no websocket. Set it totrueand it connects like a login; set it back tofalseand it disconnects and clears its data like a logout. It defaults totrue, so existing code is unaffected.Use this instead of conditionally mounting
KnockProvider, for example to wait for a user token that loads asynchronously:<KnockProvider apiKey={apiKey} user={{ id: userId }} userToken={userToken} enabled={Boolean(userId && userToken)} />
Also fixed:
useFeedSettingsno longer callsGET /v1/users/undefined/feeds/.../settingswhen there's no user.KnockProvidernow disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.
-
e8567eb: Add
useKnockAuthState()and make Slack, MS Teams, and Expo respond to sign-in changes.- New
useKnockAuthState(knock)hook re-renders when the user signs in, signs out, or switches. - Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
- Expo waits for a signed-in user before registering for push notifications, so logged-out users don't see the OS permission prompt. A notification tapped while logged out no longer tries to update its status.
- New
Patch Changes
@knocklabs/react-core@0.14.0
Minor Changes
-
e8567eb: Add an
enabledprop toKnockProvider(and anenabledoption touseAuthenticatedKnockClient).When
enabledisfalse, the provider still renders its children but the Knock client sits idle: no identify call, no API requests, no websocket. Set it totrueand it connects like a login; set it back tofalseand it disconnects and clears its data like a logout. It defaults totrue, so existing code is unaffected.Use this instead of conditionally mounting
KnockProvider, for example to wait for a user token that loads asynchronously:<KnockProvider apiKey={apiKey} user={{ id: userId }} userToken={userToken} enabled={Boolean(userId && userToken)} />
Also fixed:
useFeedSettingsno longer callsGET /v1/users/undefined/feeds/.../settingswhen there's no user.KnockProvidernow disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.
-
e8567eb: Add
useKnockAuthState()and make Slack, MS Teams, and Expo respond to sign-in changes.- New
useKnockAuthState(knock)hook re-renders when the user signs in, signs out, or switches. - Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
- Expo waits for a signed-in user before registering for push notifications, so logged-out users don't see the OS permission prompt. A notification tapped while logged out no longer tries to update its status.
- New
Patch Changes
- Updated dependencies [e8567eb]
- @knocklabs/client@0.22.0
@knocklabs/expo@0.7.0
Minor Changes
-
e8567eb: Add an
enabledprop toKnockProvider(and anenabledoption touseAuthenticatedKnockClient).When
enabledisfalse, the provider still renders its children but the Knock client sits idle: no identify call, no API requests, no websocket. Set it totrueand it connects like a login; set it back tofalseand it disconnects and clears its data like a logout. It defaults totrue, so existing code is unaffected.Use this instead of conditionally mounting
KnockProvider, for example to wait for a user token that loads asynchronously:<KnockProvider apiKey={apiKey} user={{ id: userId }} userToken={userToken} enabled={Boolean(userId && userToken)} />
Also fixed:
useFeedSettingsno longer callsGET /v1/users/undefined/feeds/.../settingswhen there's no user.KnockProvidernow disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.
-
e8567eb: Add
useKnockAuthState()and make Slack, MS Teams, and Expo respond to sign-in changes.- New
useKnockAuthState(knock)hook re-renders when the user signs in, signs out, or switches. - Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
- Expo waits for a signed-in user before registering for push notifications, so logged-out users don't see the OS permission prompt. A notification tapped while logged out no longer tries to update its status.
- New
Patch Changes
- e8567eb: Fix Expo push auto-registration not re-running when the signed-in user changes in place. The auto-register effect now depends on the authenticated
userId, so switching users on the sameKnockProvider(whereisAuthenticatednever flips) re-registers the device token against the new user's channel data. - Updated dependencies [e8567eb]
- Updated dependencies [e8567eb]
- Updated dependencies [e8567eb]
- @knocklabs/client@0.22.0
- @knocklabs/react-core@0.14.0
- @knocklabs/react-native@0.10.0
@knocklabs/client@0.22.0
Minor Changes
-
e8567eb: Make the client do nothing (instead of throwing or making requests) when there's no signed-in user, and add tools to manage sign-in state.
- New
Knock.logout()clears the user and disconnects everything: the websocket, the token-refresh timer, and the page-visibility listener. - New
knock.authStatus("authenticated"or"unauthenticated") and a subscribableknock.authStoreto check or react to whether a user is signed in. - With no signed-in user, these now do nothing instead of throwing or calling the API:
- Feed
markAs*/markAll*/fetchNextPage(they also skip the optimistic UI update). - Guides
fetch/subscribeand the step actions. These previously threw, which could crash the app when Guides rendered before a user was set. - Slack/MS Teams
authCheck(returns "not connected"),getChannels/getTeams(return empty), andmessages.batchUpdateStatuses(returns[]).
- Feed
- Fixes two Guide bugs: real-time updates broke after a re-login (a stale socket reference), and the
historypatch used for location tracking broke when a Guide provider remounted.
- New
@knocklabs/expo@0.7.0-rc.1
Patch Changes
- 6414414: Fix Expo push auto-registration not re-running when the signed-in user changes in place. The auto-register effect now depends on the authenticated
userId, so switching users on the sameKnockProvider(whereisAuthenticatednever flips) re-registers the device token against the new user's channel data.
@knocklabs/react@0.11.24
Patch Changes
- Updated dependencies [3d7a041]
- @knocklabs/client@0.21.15
- @knocklabs/react-core@0.13.16
@knocklabs/react-native@0.9.9
Patch Changes
- Updated dependencies [3d7a041]
- @knocklabs/client@0.21.15
- @knocklabs/react-core@0.13.16
@knocklabs/react-core@0.13.16
Patch Changes
- Updated dependencies [3d7a041]
- @knocklabs/client@0.21.15
@knocklabs/expo@0.6.9
Patch Changes
- Updated dependencies [3d7a041]
- @knocklabs/client@0.21.15
- @knocklabs/react-core@0.13.16
- @knocklabs/react-native@0.9.9