311-data icon indicating copy to clipboard operation
311-data copied to clipboard

ER: Updating Pin's react class components to functional components (Performance)

Open traycn opened this issue 1 year ago • 7 comments

Emergent Requirement - Updating the map Pins for better performance

  • We want to update the map Pins code from class components to functional components to see if this will make the application more performant.

Relevant Issue(s)

  • https://github.com/hackforla/311-data/issues/1865

Date discovered

  • 2/3/25

Did this require a temporary workaround? If yes, what was it?

  • N

Who was involved

  • @efrenmarin45 @ryanfchase @traycn

What happens if this is not addressed

  • The app continues to work, but will still apply the Pins logic in class component.

Resources

Recommended Action Items

  • [x] Share issue link with team Lead
  • [ ] Add to upcoming agenda

Potential Solutions

  • Update the following files: components/maps/index.js (L500) and redux/reducers/data.js

traycn avatar Feb 04 '25 01:02 traycn

Dependency on ticket: https://github.com/hackforla/311-data/issues/1865

I'd like to wait and see how the application loads with the two class components migrating to functional components before we start migrating more class components.

traycn avatar Feb 10 '25 23:02 traycn

From our discussion in our meeting about the conversion. This is from the react docs on React's recommendation for using components over classes.

efrenmarin45 avatar Feb 16 '25 02:02 efrenmarin45

From our discussion in our meeting about the conversion. This is from the react docs on React's recommendation for using components over classes.

Thank you @efrenmarin45, I've added the link you provide into the Resources section of the main ticket. I will hide these comments by the upcoming general meeting.

rayneng avatar Feb 16 '25 19:02 rayneng

Looking into this file by file, leaving comments as I go along. Should have an update by our next meeting on 8/13/25.

efrenmarin45 avatar Jul 29 '25 02:07 efrenmarin45

Looking into this file by file, leaving comments as I go along. Should have an update by our next meeting on 8/13/25.

@efrenmarin45 just to clarify, you are providing an assessment on level of work required to migrate all components that manage any SR data (aka Pins) to functional components, correct? Or are you more generally assessing migrating all components. Either is fine, but I wanted to double check.

That being said, I think only the <Map/> and <MapContainer/> classes rely on SR data being passed as props. But migrating them to functional surely warrants more preparation. Let me know if that's your assessment as well.

For extra credit, let's discuss with the team about how SR data is managed by Redux Sagas (iirc that's how <Map/> receives the SR data into props). I'll make sure I have this prepped, reach out if you want to discuss anything further.

rayneng avatar Jul 31 '25 06:07 rayneng

I also just realized that we have a ticket for reviewing all components. Perhaps you'd like to assign yourself to this ticket and move to in-progress. Sorry, I haven't been very clear on whether Emergent Requests are "pick-up-able". Here's the ticket:

  • https://github.com/hackforla/311-data/issues/1988

rayneng avatar Aug 01 '25 07:08 rayneng

@ryanfchase I think your suggestion would be a better option. I'll assign myself to #1988 and move to in progress. I'll be doing a full assessment of all the applicable files and proposing options so we can discuss as a team.

efrenmarin45 avatar Aug 07 '25 02:08 efrenmarin45