Skip to content

Commit

Permalink
Stream and UserProfile Fix (#1419)
Browse files Browse the repository at this point in the history
* fix: fixed stream issue

* fix: added new restapi version
  • Loading branch information
mishramonalisha76 authored Nov 7, 2024
1 parent 52f8576 commit 573a858
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/uiweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"uuid": "^9.0.1"
},
"peerDependencies": {
"@pushprotocol/restapi": "1.7.25",
"@pushprotocol/restapi": "1.7.29",
"@pushprotocol/socket": "^0.5.0",
"react": ">=16.8.0",
"styled-components": "^6.0.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ProfileContainer } from '../reusables';
import { ThemeContext } from '../theme/ThemeProvider';
import { UpdateUserProfileModal } from './UpdateUserProfileModal';

import { device } from '../../../config';
import { GUEST_MODE_ACCOUNT, device } from '../../../config';
import VerticalEllipsisIcon from '../../../icons/VerticalEllipsis.svg';
import UserProfileIcon from '../../../icons/userCircleGear.svg';
import { MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE } from '../../../types';
Expand Down Expand Up @@ -96,7 +96,7 @@ export const UserProfile: React.FC<UserProfileProps> = ({
member={{
web3Name: web3Name,
abbrRecipient: shortenText(pCAIP10ToWallet(user?.account || ''), 8, true) as string,
recipient: user!.account,
recipient: user?.account || GUEST_MODE_ACCOUNT,
icon: userProfile?.profile?.picture || null,
}}
copy={true}
Expand Down
9 changes: 5 additions & 4 deletions packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,10 @@ export const ChatUIProvider = ({

// check and filter out the streams which are not connected
const streamsToConnect = streams.filter((stream) => !connectedStreams.listen?.includes(stream));

const uniqueStreams = [...new Set([...connectedStreams.listen, ...streams])];

if (streamsToConnect.length) {
await userInstance.stream?.reinit(streams, {
await userInstance.stream?.reinit(uniqueStreams, {
connection: {
retries: 3, // number of retries in case of error
},
Expand Down Expand Up @@ -415,10 +416,10 @@ export const ChatUIProvider = ({

// setTimeout(async () => {
// console.debug('UIWeb::ChatDataProvider::attachListenersAndConnect::Timeout Connect', userInstance?.stream?.uid);
if (!userInstance.stream?.connected()) {
if (!userInstance?.stream?.connected()) {
console.debug('UIWeb::ChatDataProvider::attachListenersAndConnect::Stream not connected', userInstance);

await userInstance.stream?.connect();
await userInstance?.stream?.connect();
console.debug(
'UIWeb::ChatDataProvider::attachListenersAndConnect::Stream listeners attached and stream connected',
userInstance?.stream?.uid
Expand Down

0 comments on commit 573a858

Please sign in to comment.