Skip to content

Commit

Permalink
fix: conflicts with uikit (#384)
Browse files Browse the repository at this point in the history
## Changes

- Use `disconnectWebsocket` instead of `disconnect` (applied changes
from [PR
#1219](sendbird/sendbird-uikit-react#1219))
- Prevent changes to the theme if it has already been added by other
logic.
- Added `localCacheEnabled` flag to control the use of local cache in
the Chat SDK.

ticket: [AC-4281]

## Additional Notes
- uikit changes:
sendbird/sendbird-uikit-react@f8af870...4fc0619

## Checklist
Before requesting a code review, please check the following:
- [x] **[Required]** CI has passed all checks.
- [x] **[Required]** A self-review has been conducted to ensure there
are no minor mistakes.
- [x] **[Required]** Unnecessary comments/debugging code have been
removed.
- [x] **[Required]** All requirements specified in the ticket have been
accurately implemented.
- [x] Ensure the ticket has been updated with the sprint, status, and
story points.


[AC-4281]:
https://sendbird.atlassian.net/browse/AC-4281?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
bang9 authored Nov 11, 2024
1 parent 3a5afda commit e0dd61a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/widget/ProviderContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const SBComponent = ({ children }: { children: React.ReactElement }) => {
isMobileView,
dateLocale,
enableHideWidgetForDeactivatedUser,
localCacheEnabled,
} = useConstantState();

const { setIsVisible } = useWidgetState();
Expand Down Expand Up @@ -80,6 +81,7 @@ const SBComponent = ({ children }: { children: React.ReactElement }) => {
nickname={userNickName}
customApiHost={apiHost}
customWebSocketHost={wsHost}
sdkInitParams={{ localCacheEnabled }}
configureSession={configureSession}
customExtensionParams={userAgentCustomParams}
breakpoint={isMobileView} // A property that determines whether to show it with a layout that fits the mobile screen. Or you can put the width size with `px`.
Expand Down
5 changes: 5 additions & 0 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ export interface Constant extends ConstantFeatureFlags, ConstantAIFeatures {
* @description Callback to be called when the widget open state changes.
*/
onWidgetOpenStateChange?: (params: OnWidgetOpenStateChangeParams) => void;
/**
* @private
* @description Determines whether to use the local cache of the Chat SDK.
*/
localCacheEnabled?: boolean;
}

interface ConstantAIFeatures {
Expand Down
1 change: 1 addition & 0 deletions src/context/ConstantContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const ConstantStateProvider = (props: PropsWithChildren<ConstantContextPr
botStudioEditProps: props.botStudioEditProps,
widgetOpenState: props.widgetOpenState,
onWidgetOpenStateChange: props.onWidgetOpenStateChange,
localCacheEnabled: props.localCacheEnabled,
messageInputControls: {
...initialState.messageInputControls,
...props.messageInputControls,
Expand Down

0 comments on commit e0dd61a

Please sign in to comment.