Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Simplify logic to populate and name entries in the platformList module #575

Open
naomatheus opened this issue Sep 15, 2023 · 0 comments
Labels
maintenance Tickets that do not encompass new features but contribute to the overall quality of the project

Comments

@naomatheus
Copy link
Collaborator

we could simplify the logic that handles populating and renaming the platform lists on CASEI's Explore pages by having the translation of the group name occur within the usePlatformList hook itself. First identified in comments in #574

@alukach: we could simplify this by having the translation of the group name occur within the usePlatformList hook itself to reduce the number of files and functions in this project. Also an implementation like this will allow future consumers of usePlatformList to get the same results as what we are rendering in the ExplorePlatforms components:

const groupByPlatformType = (acc, item) => {
  const categoryTranslations = {
    Aircraft: "Air-based platforms",
  };

  const group =
    categoryTranslations[item.searchCategory] ?? item.searchCategory ?? "Other";

  (acc[group] ??= []).push(item);

  return acc;
};

In #574 this was attempted, but I encountered unexpected Render Lifecycle behavior:

  • After the first time the page renders, we then have more items pushed into the platform list. It gives correct results on the first render, but then on the second render the Air-based platforms are pushed to include 320 platforms (all platforms).
@naomatheus naomatheus added the maintenance Tickets that do not encompass new features but contribute to the overall quality of the project label Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Tickets that do not encompass new features but contribute to the overall quality of the project
Projects
None yet
Development

No branches or pull requests

1 participant