Skip to content

Commit

Permalink
default values and null check
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamics committed Oct 24, 2023
1 parent 8eda41a commit e4c4d3f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const DeletedNetworkMembersTable = ({ nwid }) => {
updateData: (rowIndex, columnId, value) => {
// Skip page index reset until after next rerender
// skipAutoResetPageIndex()
setData((old: MemberEntity[]) =>
setData((old: MemberEntity[] = []) =>
old.map((row, index) => {
if (index === rowIndex) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/components/networkByIdPage/table/memberEditCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const MemberEditCell = ({ nwid, central = false }: IProp) => {
{generateClipboardElement(hasRfc4193, rfc4193Ip)}
{generateClipboardElement(has6plane, sixPlaneIp)}

{original?.ipAssignments.map((assignedIp) => {
{original?.ipAssignments?.map((assignedIp) => {
const subnetMatch = isIPInSubnet(assignedIp, networkById.network?.routes);
return (
<div key={assignedIp} className="flex">
Expand Down
2 changes: 2 additions & 0 deletions src/components/networkByIdPage/table/memberHeaderColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const sortingMemberHex = (
};
const hexToBigInt = (hex: string) => BigInt(`0x${hex}`);
const sortIP = (ip: string) => {
if (!ip) return BigInt(0);

if (ip.includes(":")) {
const fullAddress = ip
.split(":")
Expand Down
6 changes: 3 additions & 3 deletions src/components/networkByIdPage/table/networkMembersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const NetworkMembersTable = ({ nwid, central = false }: IProp) => {
updateData: (rowIndex, columnId, value) => {
// Skip page index reset until after next rerender
skipAutoResetPageIndex();
setData((old) =>
setData((old = []) =>
old.map((row, index) => {
if (index === rowIndex) {
return {
Expand Down Expand Up @@ -136,7 +136,7 @@ export const NetworkMembersTable = ({ nwid, central = false }: IProp) => {
<tr key={headerGroup.id}>
{
// Loop over the headers in each row
headerGroup.headers.map((header) => (
headerGroup.headers?.map((header) => (
<th
key={header.id}
colSpan={header.colSpan}
Expand Down Expand Up @@ -173,7 +173,7 @@ export const NetworkMembersTable = ({ nwid, central = false }: IProp) => {
// Loop over the table rows
table
.getRowModel()
.rows.map((row) => {
.rows?.map((row) => {
const notation = row.original?.notations || [];
return (
<tr
Expand Down

0 comments on commit e4c4d3f

Please sign in to comment.