Skip to content

Commit 4589c86

Browse files
Merge pull request #7625 from TheThingsNetwork/fix/users-fetch-table
Fix searching users in user management
2 parents 15a7bd9 + e7a7753 commit 4589c86

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ For details about compatibility between different releases, see the **Commitment
2626

2727
### Fixed
2828

29+
- Fixed searching users in User management in the Console.
30+
2931
### Security
3032

3133
## [3.34.1] - 2025-04-28

pkg/webui/console/containers/users-table/index.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import React from 'react'
15+
import React, { useMemo } from 'react'
1616
import { useDispatch, useSelector } from 'react-redux'
1717
import { defineMessages } from 'react-intl'
1818
import { createSelector } from 'reselect'
@@ -30,7 +30,6 @@ import Message from '@ttn-lw/lib/components/message'
3030
import DateTime from '@ttn-lw/lib/components/date-time'
3131

3232
import sharedMessages from '@ttn-lw/lib/shared-messages'
33-
import PropTypes from '@ttn-lw/lib/prop-types'
3433
import { getUserId } from '@ttn-lw/lib/selectors/id'
3534
import attachPromise from '@ttn-lw/lib/store/actions/attach-promise'
3635

@@ -111,21 +110,20 @@ const state = {
111110
},
112111
}
113112

114-
const UsersTable = props => {
115-
const { pageSize } = props
113+
const UsersTable = () => {
116114
const dispatch = useDispatch()
117115
const currentUserId = useSelector(selectUserId)
118116
const mayInvite = useSelector(state => checkFromState(maySendInvites, state))
119117
const mayPerformAllActions = useSelector(state => checkFromState(mayPerformAllUserActions, state))
120118
const mayCreate = useSelector(state => checkFromState(mayCreateUsers, state))
121-
122-
const tabsWithInvitations = [
123-
...tabs,
124-
{ title: sharedMessages.userInvitations, name: INVITATIONS_TAB },
125-
]
126119
const [tab, setTab] = React.useState(USERS_TAB)
127-
const isInvitationsTab = tab === INVITATIONS_TAB
128-
const isDeletedTab = tab === DELETED_TAB
120+
const isInvitationsTab = useMemo(() => tab === INVITATIONS_TAB, [tab])
121+
const isDeletedTab = useMemo(() => tab === DELETED_TAB, [tab])
122+
123+
const tabsWithInvitations = useMemo(
124+
() => [...tabs, { title: sharedMessages.userInvitations, name: INVITATIONS_TAB }],
125+
[],
126+
)
129127

130128
const handleRestore = React.useCallback(
131129
async id => {
@@ -187,7 +185,7 @@ const UsersTable = props => {
187185
[dispatch],
188186
)
189187

190-
const headers = React.useMemo(() => {
188+
const headers = useMemo(() => {
191189
const baseHeaders = []
192190

193191
if (tab === INVITATIONS_TAB) {
@@ -354,22 +352,12 @@ const UsersTable = props => {
354352
getItemPathPrefix={isInvitationsTab ? getItemPathPrefix : undefined}
355353
tableTitle={<Message content={sharedMessages.users} />}
356354
getItemsAction={getItems}
357-
searchItemsAction={getItems}
358355
baseDataSelector={isInvitationsTab ? invitationsBaseDataSelector : usersBaseDataSelector}
359-
pageSize={pageSize}
360356
clickable={!isDeletedTab}
361357
tabs={mayInvite ? tabsWithInvitations : tabs}
362358
searchable={!isInvitationsTab}
363359
/>
364360
)
365361
}
366362

367-
UsersTable.propTypes = {
368-
pageSize: PropTypes.number,
369-
}
370-
371-
UsersTable.defaultProps = {
372-
pageSize: undefined,
373-
}
374-
375363
export default UsersTable

0 commit comments

Comments
 (0)