Conversation
github-actions Bot
pushed a commit
that referenced
this pull request
Apr 23, 2025
use batch get event donors by id d128bf2
There was a problem hiding this comment.
Pull Request Overview
This PR implements a batch retrieval mechanism for event donor data by ID to improve performance and consistency. Key changes include:
- Updating the donor export service to fetch donor IDs first and then retrieve donor data in one batch.
- Adding new server endpoints: one for obtaining donor IDs for an event and another for fetching donor data in batch.
- Minor UI refinement in the donors component to trim organization names before display.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| client/src/services/donorService.js | Refactored exportEventDonorsToCsv to use batch donor fetching via a new helper. |
| client/src/components/donors/Donors.jsx | Updated organization name rendering to trim whitespace before display. |
| Server/src/routes/event.js | Added a new GET endpoint to retrieve donor IDs for a given event. |
| Server/src/routes/donor.js | Added a new POST endpoint to fetch donors in batch based on provided donor IDs. |
| <div className="donor-profile-simple"> | ||
| <h4>{selectedDonor.donor?.firstName || selectedDonor.firstName} {selectedDonor.donor?.lastName || selectedDonor.lastName}</h4> | ||
| {(selectedDonor.donor?.organizationName || selectedDonor.organizationName) && ( | ||
| {((selectedDonor.donor?.organizationName || selectedDonor.organizationName)?.trim()) && ( |
There was a problem hiding this comment.
[nitpick] Consider handling the case where the organization name consists only of whitespace. If the trimmed value is an empty string, you might want to provide a fallback or avoid rendering the element.
Suggested change
| {((selectedDonor.donor?.organizationName || selectedDonor.organizationName)?.trim()) && ( | |
| {((selectedDonor.donor?.organizationName || selectedDonor.organizationName)?.trim().length > 0) && ( |
| export const getBatchDonors = async (donorIds) => { | ||
| try { | ||
| const result = await fetchWithAuth(`/api/donors/batch`, { | ||
| method: 'POST', |
There was a problem hiding this comment.
Ensure that fetchWithAuth includes the appropriate 'Content-Type': 'application/json' header for POST requests so that the JSON payload is processed correctly by the server.
Suggested change
| method: 'POST', | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json' | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.