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

[Bug Fix] Leaflet gets broken after updating labels #1137

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

jiji14
Copy link
Contributor

@jiji14 jiji14 commented Mar 19, 2024

Overview

After optimizing the Leaflet map, a bug appears when updating labels.
We cache the map after rendering a Leaflet map and reset the leafletMapRef. However, when the map information changes, we need to re-render the map using initMap. Currently, this doesn't happen because we reset leafletMapRef, causing it to fail the conditional check.

Before

Screenshot 2024-03-19 at 1 02 43 PM

After

Screen.Recording.2024-03-19.at.1.02.00.PM.mov

It triggers an error with re-rendering after the trip information gets changed (ex) changing label
@jiji14
Copy link
Contributor Author

jiji14 commented Mar 19, 2024

@JGreenlee @shankari Please check this PR 🙏

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.49%. Comparing base (5812eee) to head (a5a8367).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1137   +/-   ##
=======================================
  Coverage   77.49%   77.49%           
=======================================
  Files          29       29           
  Lines        1693     1693           
  Branches      370      370           
=======================================
  Hits         1312     1312           
  Misses        381      381           
Flag Coverage Δ
unit 77.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@shankari
Copy link
Contributor

LGTM! Once Jack reviews, I will merge

@shankari
Copy link
Contributor

@JGreenlee tagging you for review

Copy link
Collaborator

@JGreenlee JGreenlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works well and looks good to me.

I tested this locally in the devapp because I wanted to make sure the color of the trajectory updates if the mode changes from one base mode to another (for example, bike -> car changes from green to red)

@shankari shankari merged commit 2736da7 into e-mission:master Mar 22, 2024
8 checks passed
@shankari
Copy link
Contributor

@JGreenlee @jiji14 just to check, why was this not caught by the unit tests? It is a 100% reproducible bug for a fairly common function. Do we not have a test that pretends to click the button and label the trip?

@JGreenlee
Copy link
Collaborator

JGreenlee commented Mar 22, 2024

@shankari I think we would have needed integration testing or end-to-end testing for this to have been caught. We started with integrating Appium, but it is a significant effort. After encountering roadblocks with setup, we have not been able to prioritize it since there have been more urgent tasks lately

I have been loosely formulating a plan which I think would make integration testing more easily achievable, which is to support a version of the UI that runs as an Expo web app, detached from the native code.
Essentially, when Cordova is not available it would use a web compatibility layer for things the UI needs like usercache and servercomm. There would be no tracking; it would only display data that was already synced from another device.

Because it would be web-only, we could test the full extent of its capability, including integration testing with actual server calls.
And there's a couple bonus benefits, i) it will make it easier to transition to Expo, and ii) we will have a web version lying around if someone ever asks for it

@shankari
Copy link
Contributor

the web compatibility layer is an interesting idea and definitely the standard approach towards software based testing (e.g. creating mock/proxies/hardware abstraction layer). It would be interesting to see how thick the layer would need to be. If we are not testing the data collection, maybe only the usercache and the server calls. Would be great to have the web version "in our back pockets" in case there is a request for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Address code reviews with "future"
Development

Successfully merging this pull request may close these issues.

3 participants