PhilanthropyDataCommons / front-end

A UI for interacting with the data stored in the PDC service
https://app.philanthropydatacommons.org/
GNU Affero General Public License v3.0
1 stars 0 forks source link

Explicitly set rowClickDestination value for ProposalListTable #805

Closed hminsky2002 closed 2 months ago

hminsky2002 commented 2 months ago

In components/ProposalListTable.tsx, we explicitly set the value for rowClickDestination, yet it is a required value


interface ProposalListTableRowProps {
    columns: string[];
    proposal: FrontEndProposal;
    rowClickDestination: ProposalDetailDestinations;
    organizationId?: number;
    active?: boolean;
}

const ProposalListTableRow = ({
    proposal,
    columns,
    rowClickDestination = ProposalDetailDestinations.PROPOSAL_DETAIL_PAGE,
    organizationId = undefined,
    active = false,

Furthermore, when we render the ProposalListTable in the ProposalListTablePanel component, we do not provide a vale for rowClickDestination (components/ProposalListTablePanel.tsx lines 52-62)

<PanelBody padded={!hasProposals}>
                {hasProposals ? (
                    <ProposalListTable
                        fieldNames={fieldNames}
                        proposals={proposals}
                        wrap={wrap}
                    />
                ) : (
                    <div className="quiet">{generateFallbackMessage()}</div>
                )}
            </PanelBody>

We should instead set the rowClickDestination prop explicitly inside the ProposalListTablePanel component and remove the default values from our components.

jasonaowen commented 2 months ago

It's worth mentioning that this came out of https://github.com/PhilanthropyDataCommons/front-end/pull/748#discussion_r1710288746, because newer versions of TypeScript and/or ESLint will complain about the mix of optional fields and default values.