Project-Chirp / chirp-frontend

Frontend of Chirp
2 stars 3 forks source link

T129: Fix edit post modal crash #130

Closed Dennull closed 2 days ago

Dennull commented 3 days ago

Related Issues

Resolves #129

Summary

Context

When navigating to an expanded post, the app crashes. This was because we were trying to find the post to pass into our post edit modal using a .find() in our posts state in the post store. On the expanded post page, this state gets overridden to hold the expanded post replies rather than the previous post list that contained the post the user clicked on; hence, the find() operation would return undefined because that post id was no longer present in the array

Solution

To address this, we shouldn't be looking for the post in the store; rather, we should just pass it down as a prop to the post menu and edit post modal directly

Changes Made

Passed the post object down as a prop to our PostMenu and EditPostModal respectively

Screenshots

No additional screenshots

Testing Instructions

No additional testing instructions

Special Notes for Your Reviewer(s)

No additional notes