Skip to content

bug: sort by recent is not actually sorting by recent #37

Description

@shub2726

description

when selecting sort by recent in the Experiences component, the experiences are not sorted by date. instead, the api response is just set directly into state without applying any sorting.

file: Experiences.jsx

if (sortBy === "recent") {
  const response = await fetch(
    `${process.env.REACT_APP_API_URL || "http://localhost:8000"}/api/experiences`,
    { credentials: "include" }
  );
  const data = await response.json();
  setExperiences(data);
  setGrouped({});
}

expected behavior

experiences should be ordered by most recent first (based on their date field).

actual behavior

experiences appear in the order returned from the api, not sorted by recent.

steps to reproduce

  1. go to the experiences page.
  2. select "sort by recent" (default).
  3. notice that the order of experiences after scrolling completely down. nisarg did NOT add his experience before others.
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions