Add null checks to transform functions

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-17 22:47:19 +00:00
parent d58fa8be2a
commit 0bf5a9d42c

View File

@@ -31,9 +31,9 @@ export const updateNewTodo = (data: any, event: any) => event?.target?.value ||
export const checkCanAddTodo = (data: any) => data.newTodo?.trim().length > 0
export const transformFilteredUsers = (users: any[]) => `${users.length} users`
export const transformFilteredUsers = (users: any[]) => `${users?.length || 0} users`
export const transformUserList = (users: any[]) => users.map((user: any) => ({
export const transformUserList = (users: any[]) => (users || []).map((user: any) => ({
type: 'Card',
id: `user-${user.id}`,
props: {