Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Mapping Functions to Handle Undefined Values #179

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading