File tree Expand file tree Collapse file tree 4 files changed +27
-19
lines changed
ChannelSettings/components/ModerationPanel
CreateChannel/components/InviteUsers Expand file tree Collapse file tree 4 files changed +27
-19
lines changed Original file line number Diff line number Diff line change 11export const createDefaultUserListQuery = ( { sdk, userFilledApplicationUserListQuery = { } } ) => {
2- const params = sdk . createApplicationUserListQuery ( ) ;
3- if ( userFilledApplicationUserListQuery ) {
4- Object . keys ( userFilledApplicationUserListQuery ) . forEach ( ( key ) => {
5- params [ key ] = userFilledApplicationUserListQuery [ key ] ;
6- } ) ;
2+ if ( sdk ?. createApplicationUserListQuery ) {
3+ const params = sdk ?. createApplicationUserListQuery ( ) ;
4+ if ( userFilledApplicationUserListQuery ) {
5+ Object . keys ( userFilledApplicationUserListQuery ) . forEach ( ( key ) => {
6+ params [ key ] = userFilledApplicationUserListQuery [ key ] ;
7+ } ) ;
8+ }
9+ return params ;
710 }
8- return params ;
11+ return null ;
912} ;
1013
1114const getApplicationAttributes = ( sdk = { } ) => {
Original file line number Diff line number Diff line change @@ -27,10 +27,12 @@ export default function InviteUsers({
2727
2828 useEffect ( ( ) => {
2929 const userListQuery = globalUserListQuery ? globalUserListQuery ( ) : sdk ?. createApplicationUserListQuery ( ) ;
30- userListQuery . next ( ) . then ( ( members ) => {
31- setMembers ( members ) ;
32- } ) ;
33- setUserQuery ( userListQuery ) ;
30+ if ( userListQuery ?. next ) {
31+ userListQuery . next ( ) . then ( ( members ) => {
32+ setMembers ( members ) ;
33+ } ) ;
34+ setUserQuery ( userListQuery ) ;
35+ }
3436 } , [ sdk ] )
3537 return (
3638 < div >
Original file line number Diff line number Diff line change @@ -27,11 +27,13 @@ type CreateDefaultUserListQueryType = {
2727export const createDefaultUserListQuery = (
2828 { sdk, userFilledApplicationUserListQuery } : CreateDefaultUserListQueryType
2929) : ApplicationUserListQuery => {
30- const params = sdk . createApplicationUserListQuery ( ) ;
31- if ( userFilledApplicationUserListQuery ) {
32- Object . keys ( userFilledApplicationUserListQuery ) . forEach ( ( key ) => {
33- params [ key ] = userFilledApplicationUserListQuery [ key ] ;
34- } ) ;
30+ if ( sdk ?. createApplicationUserListQuery ) {
31+ const params = sdk ?. createApplicationUserListQuery ( ) ;
32+ if ( userFilledApplicationUserListQuery ) {
33+ Object . keys ( userFilledApplicationUserListQuery ) . forEach ( ( key ) => {
34+ params [ key ] = userFilledApplicationUserListQuery [ key ] ;
35+ } ) ;
36+ }
37+ return params ;
3538 }
36- return params ;
3739} ;
Original file line number Diff line number Diff line change @@ -37,18 +37,19 @@ export default function MentionLabel(props: MentionLabelProps): JSX.Element {
3737 const [ user , setUser ] = useState < User | null > ( ) ;
3838 const fetchUser = useCallback (
3939 ( toggleDropdown ) => {
40- if ( user ) {
40+ if ( user || ! sdk ?. createApplicationUserListQuery ) {
4141 toggleDropdown ( ) ;
42+ return ;
4243 }
43- const query = sdk . createApplicationUserListQuery ( {
44+ const query = sdk ? .createApplicationUserListQuery ( {
4445 userIdsFilter : [ mentionedUserId ] ,
4546 } ) ;
4647 query . next ( ) . then ( ( members ) => {
4748 if ( members ?. length > 0 ) {
4849 setUser ( members [ 0 ] ) ;
4950 }
5051 toggleDropdown ( ) ;
51- } )
52+ } ) ;
5253 } ,
5354 [ sdk , mentionedUserId ] ,
5455 ) ;
You can’t perform that action at this time.
0 commit comments