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

Split ExtendedData type into base data and additional data #546

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cirex-web
Copy link
Contributor

@cirex-web cirex-web commented Feb 2, 2025

Ohayou!

This PR splits API data into its original locations data and any extra status data (the stuff that gets updated every second) into a map from conceptId to data. We then rejoin the two things inside ListPage. Types were updated accordingly. (hopefully to better names this time around...)

<ListPage
extraLocationData={extraLocationData}
locations={locations}
/>

Why?

  • We can now instantiate Fuse when the raw API data is updated rather than making a Fuse object every second when the status for each location gets updated in the interval call.
  • Separation of concerns/more explicit divison, in case people want to add more things to extra location data.

Bug fixes

  • Removed "No results found" page flash on initial render. (it was because filteredLocations was only updated a render after Fuse was defined, which in turn was only set a render after locations was populated). I changed everything to useMemo and React now updates everything in one pass-through

The bug:

Screen.Recording.2025-02-01.at.8.08.40.PM.mov
image
  • Fuse now searches the entire string instead of just the start. (I added ignoreLocation: true) option
    image (I also just noticed that two other open PRs do approximately the same thing... lol)

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test A
  • Test B

Test Configuration:

  • Node.js version:
  • Python version:
  • Desktop/Mobile:
  • OS:
  • Browser:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

…search, fix initial no search results glitch
Copy link

vercel bot commented Feb 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmueats ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2025 5:44pm

@cirex-web cirex-web changed the title Split ExtendedData type into base data and additional data as a map from conceptId to extra data Split ExtendedData type into base data and additional data Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant