openedx / frontend-app-discussions

A React-based micro frontend for the Open edX discussion forums.
GNU Affero General Public License v3.0
6 stars 61 forks source link

[BACKPORT] fix: posts sorting on sidebar #687

Open dyudyunov opened 3 months ago

dyudyunov commented 3 months ago

Backport from the master

Description

Fix wrong sorting when a user creates several posts without the page reloading.

Steps to reproduce

  1. [Precondition] The new discussions experience (discussions sidebar) should be enabled
  2. Navigate to any course unit where the discussions sidebar is enabled
  3. Create a new post.
  4. Click on the "Back to list" button. Note that the default sorting is used (most recent first) and it's correct.
  5. Create another post without reloading the page
  6. Click on the "Back to list" button and check the result

Actual result

The second created post is the last in the list (the same for any number of posts created additionally).

image

Expected result (with the fix applied)

Sorting works as expected - most recent posts are displayed first.

discuss_sorting

Additional Notes

openedx-webhooks commented 3 months ago

Thanks for the pull request, @dyudyunov! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

dyudyunov commented 3 months ago

My changes require further improvements - there are unneeded additional GET requests to the threads endpoint.

I will change the status to Draft for now

dyudyunov commented 3 months ago

My changes require further improvements - there are unneeded additional GET requests to the threads endpoint.

I will change the status to Draft for now

I figured out how to get rid of the unneeded API call, now it's ready for review