SSWConsulting / SSWConsulting/SSW.Website

💸 Events - Compare loaded Events by reference

Open
#3,066 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
14
Forks
10
Avg merge
13h 51m
Merged PRs (30d)
38

Description

Description
When loading events using react query the array reference will be changed every time a property from the infinite query changes (e.g. if the loading state changes). To fix a flickering issue that occurs when the user loads new events I added a check that occurs before the animation plays to make sure the values of the events match. ❌ This is operation is o(n) and we have a large number of events so its' quite inefficient.

Proposed solution

- [ ] memoize the previous value of the event list so that it only updates when the loading button is clicked or the filters change.
- [ ] pass the memoized value for the event list into the event list component
- [ ] update the event list to toggle visibility after comparing the reference for the event list and making sure it was updated

Screenshots

Image

Figure Bad ❌ - comparing the previous events list by value in components/filter/events.tsx

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading components/filter/events.tsx, where the current event-list comparison is described, and trace the event list component and React Query loading or filter changes. The work is done when the list uses a memoized event-list reference and visibility changes only after that reference is updated, without the existing value-by-value comparison or flicker.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react
Domain
frontend, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.