Skip to content

Commit

Permalink
add taskProps to ProjectInteraction.jsx to prevent errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Pentecost authored and Richard Pentecost committed Jan 18, 2024
1 parent 6812623 commit 652d31b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
39 changes: 18 additions & 21 deletions src/client/components/CollectionList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,24 @@ const CollectionList = ({
)
)}
</ol>
{taskProps && (
<Task.Status {...taskProps}>
{() =>
isComplete && (
<>
<ol>
{results.map((item, i) => (
<CollectionItem {...item} key={i} />
))}
</ol>
<Pagination
totalPages={totalPages}
onPageClick={onPageClick}
activePage={activePage}
/>
</>
)
}
</Task.Status>
)}
{/* )} */}
<Task.Status {...taskProps}>
{() =>
isComplete && (
<>
<ol>
{results.map((item, i) => (
<CollectionItem {...item} key={i} />
))}
</ol>
<Pagination
totalPages={totalPages}
onPageClick={onPageClick}
activePage={activePage}
/>
</>
)
}
</Task.Status>
</article>
</GridCol>
</GridRow>
Expand Down
29 changes: 21 additions & 8 deletions src/client/modules/Investments/Projects/ProjectInteractions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
} from '../../../components/Resource'
import urls from '../../../../lib/urls'
import ProjectLayout from '../../../components/Layout/ProjectLayout'
import { INTERACTIONS__LOADED } from '../../../actions'
import { TASK_GET_INTERACTIONS_LIST } from '../../Interactions/CollectionList/state'

const ProjectInteractions = () => {
const history = useHistory()
Expand All @@ -20,15 +22,25 @@ const ProjectInteractions = () => {
const activePage = parseInt(parsedQueryString.page, 10) || 1

const { projectId } = useParams()

const payload = {
investment_project_id: projectId,
limit: 10,
offset: activePage * 10 - 10,
sortby: parsedQueryString.sortby,
}

const collectionListTask = {
name: TASK_GET_INTERACTIONS_LIST,
id: projectId,
progressMessage: 'Loading interactions',
startOnRender: {
payload: payload,
onSuccessDispatch: INTERACTIONS__LOADED,
},
}
return (
<InteractionCollectionResource
payload={{
investment_project_id: projectId,
limit: 10,
offset: activePage * 10 - 10,
sortby: parsedQueryString.sortby,
}}
>
<InteractionCollectionResource payload={payload}>
{(_, count, rawData) => {
const interactions = rawData.results.map(transformInteractionToListItem)
const sortOptions = [
Expand Down Expand Up @@ -74,6 +86,7 @@ const ProjectInteractions = () => {
}),
})
}
taskProps={collectionListTask}
activePage={activePage}
sortOptions={count ? sortOptions : null}
addItemUrl={urls.investments.projects.interactions.createType(
Expand Down

0 comments on commit 652d31b

Please sign in to comment.