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

EDSC-2673: Lazy load Leaflet #1746

Merged
merged 21 commits into from
Jun 3, 2024
Merged

EDSC-2673: Lazy load Leaflet #1746

merged 21 commits into from
Jun 3, 2024

Conversation

eudoroolivares2016
Copy link
Contributor

@eudoroolivares2016 eudoroolivares2016 commented May 17, 2024

Overview

What is the feature?

Lazy load the MapContainer.js component

What is the Solution?

Update the imports for MapContainer.js so that it is bundled separately, have the error-boundry use the Spinner with a new class for when the Map is loading. Updated Project component to be a functional component and rendering it the same way as the other routes are. Updated App.test.js for technical debt and to test that the Map is being loaded after being awaited. Updated the project.test.js route tests to RTL for tech debt. Updates class names which were not being used before to the correct ones, add a new scss modifier for the loading state

What areas of the application does this impact?

Search page, Projects page routes. Background color and scss for the other routes

Testing

  1. Ensure that the map container is not getting reloaded. Go to a page that does not contain the map such as the contact-info page. Open the DevTools and use the Coverage command to see what is being loaded onto the page ensure that the MapContainer.js component is not being loaded in. NOTE In order to be able to see the error boundry/Spinner, we will need to throttle internet connectivity, as was done in the screenshots the devTools network tab can be used to throttle

Ensure that the project page continues to work as expected: create new projects, go to the saved projects page, go to a project from that page, hit the download button from the project page, ensure the form submission works as expected

Attachments

Loading state for /project (throttling connection)
Pasted Graphic 8

Loading state for /search (throttling connection)
Pasted Graphic 9

Loaded state for the project page
image

Loaded state for the /search page
image

Checklist

  • I have added automated tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have performed a self-review of my own 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

@eudoroolivares2016 eudoroolivares2016 changed the title Edsc 2673 EDSC-2673: Lazy load Leaflet May 17, 2024
@codecov-commenter
Copy link

codecov-commenter commented May 17, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 92.00%. Comparing base (46949ab) to head (160a35e).

Files Patch % Lines
static/src/js/App.js 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1746      +/-   ##
==========================================
- Coverage   92.01%   92.00%   -0.01%     
==========================================
  Files         744      744              
  Lines       19769    19760       -9     
  Branches     4698     4698              
==========================================
- Hits        18190    18180      -10     
- Misses       1441     1442       +1     
  Partials      138      138              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

static/src/css/_layout.scss Outdated Show resolved Hide resolved
static/src/js/App.js Outdated Show resolved Hide resolved
static/src/js/App.js Show resolved Hide resolved
static/src/js/routes/Project/Project.js Show resolved Hide resolved
@@ -1,4 +1,8 @@
import React, { Component } from 'react'
import React, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Taking a look at this bundle coverage while running the production build

@@ -51,6 +52,11 @@
.route-wrapper--content-page-centered & {
justify-content: center;
}

&--dark {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were references to this classname before my change i.e. before they existed in some routes I don't think that they were doing anything but, now they do have to be changed correctly

static/src/js/routes/Project/Project.js Show resolved Hide resolved
const { enzymeWrapper } = setup()
const helmet = enzymeWrapper.find(Helmet)
expect(helmet.props().titleTemplate).toEqual('[DEV] %s | Earthdata Search')
// TODO this is just a prop being passed in Helmet its not rendered on DOM so I think that we should remove it for RTL test
Copy link
Member

Choose a reason for hiding this comment

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

Remove or resolve TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah thats right. I added this since I wasn't able to migrate this test. Since our overall test coverage on this file has increased and the meta element value is being checked in a different test I am suggesting to delete it

@eudoroolivares2016 eudoroolivares2016 merged commit 8bb04ee into main Jun 3, 2024
11 checks passed
@eudoroolivares2016 eudoroolivares2016 deleted the EDSC-2673 branch June 3, 2024 18:00
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.

None yet

4 participants