fix: display invoice and customer data on frontend (#42) #117
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.
Fix route ordering in invoices.js to ensure GET / comes before GET /:id This ensures query parameter requests are correctly routed to getInvoicesByUser instead of potentially matching the parameterized route.
Add optional chaining in ClientList.js to prevent runtime errors Changed user.result.googleId to user?.result?.googleId to handle cases where user object structure is unexpected.
Improve error handling in invoiceActions.js and clientActions.js Added END_LOADING dispatch and empty array payload in catch blocks to prevent infinite loading states and enable graceful error handling.
These changes ensure that invoices and customers created by users are properly fetched from the backend and displayed in the UI. The route ordering fix was the primary issue preventing data from being retrieved, while the optional chaining and error handling improvements provide additional robustness to the codebase.
Resolves #42