-
Notifications
You must be signed in to change notification settings - Fork 9
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
Perceived performance improvement with Mapbox Static Images API #331
base: release/v1.1.0
Are you sure you want to change the base?
Commits on Oct 5, 2022
-
This PR introduces the Mapbox Component. This lays the basic foundation for the component, with the interfaces constructed through discussion with Product. Here are two relevant slack threads: https://yext.slack.com/archives/C032CKFARGS/p1658322867803349 (inception) https://yext.slack.com/archives/C032CKFARGS/p1659449732357219 (more recent) J=SLAP-2221 TEST=manual Tested through LocationsPage Later items will add jest tests and storybook for further testing NOTE: as of now, local test-site requires an `env` variable REACT_APP_MAPBOX_API_KEY for map to work properly For github workflow to work (in future test items), some changes may be needed in the workflow: facebook/create-react-app#9064 (comment)
Configuration menu - View commit details
-
Copy full SHA for ab88584 - Browse repository at this point
Copy the full SHA ab88584View commit details
Commits on Oct 10, 2022
-
mapbox component jest tests (#311)
added jest tests for Mapbox component, specifically for the two prop fields: `getCoordinate` and `onDrag`. The remaining props are best tested through storybook. note that `mapbox-gl` is mocked as it seems to use some web browser functionality on initialization that is not supported in jest test environment (jsdom). Without mocking, jest would present an error `Error: Failed to initialize WebGL.`. - tried third party libraries `jest-webgl-canvas-mock` and `jest-canvas-mock` still result in more window properties access related errors (`[TypeError: e.window.Worker is not a constructor]`, which could be resolve by [manually mocking Worker](jestjs/jest#3449), `[TypeError: this.target.addEventListener is not a function]`...). - Looked into how pageJS test mapbox provider in their map component: the map wrapper component invoke a [load function](https://github.com/yext/pages/blob/main/packages/pages/src/components/map/map.tsx#L112) to construct [a script tag](https://github.com/yext/components-tsx-maps/blob/main/src/Providers/Mapbox.js#L137) from `yext/components-tsx-maps` and the assertions in the unit tests seem to check for the rendering of the wrapper component only and not waiting for the script to load. No content/interaction of the map was tested from my understanding. - Looked into how mapbox-gl-js does their own testing: they had a couple util files to set up the environment for their tests (mock requests, [mock HtmlCanvas/WebLG in window](https://github.com/mapbox/mapbox-gl-js/blob/main/src/util/window.js) object, etc.). I decided this complexity is probably unnecessary to add to the repo but we can discuss if other may think differently. We can have jest strictly test new isolated functionalities added from the component and leave all the UI rendering and mapbox interaction to storybook tests. SLAP-2222 TEST=auto new jest tests passed
Configuration menu - View commit details
-
Copy full SHA for 8c677c6 - Browse repository at this point
Copy the full SHA 8c677c6View commit details
Commits on Oct 11, 2022
-
add react-dom as peer dep (#313)
Add react-dom as a peer dependency as it's now use in Mapbox component. Note that, ReactDOM.render is deprecated in React 18, which now have a new client render function `createRoot`. For now, a warning will display in console informing user that the app will behave as if it’s running React 17 until the code switch to the new API. A new item will be created to address this issue. TEST=manual `npm pack` the component lib. Created a new React app using react 17/18, see that react-dom is installed as peer dep (automatically install with npm >=7) and mapbox component is display as expected (there's a warning in React 18).
Configuration menu - View commit details
-
Copy full SHA for 69327c1 - Browse repository at this point
Copy the full SHA 69327c1View commit details
Commits on Oct 18, 2022
-
docs(MapboxMap): add storybook stories (#312)
single marker story multiple marker story custom marker story - follow docs.mapbox.com guide to add a simple popup pin J=SLAP-2223 TEST=manual serve and view stories
Configuration menu - View commit details
-
Copy full SHA for 731c9bd - Browse repository at this point
Copy the full SHA 731c9bdView commit details
Commits on Oct 28, 2022
-
use createRoot when possible for rendering pin components (#319)
This PR uses a dynamic imports with a .catch fallback for when react-dom/client does not exist. MapboxMap code had to be tweaked due to differences between ReactDOM.render and ReactDOM.createRoot().render(). Namely, createRoot() does not modify the container element unless it already exists on the physical page. This means that we can't call document.creatElement('div'), use createRoot, and THEN attach it to the mapbox map. Instead, we have to attach the div to the map first. This also seems it make it more difficult to unit test, my guess would be because createRoot does not do anything on the server. For now I use some jest.mocks to ensure the right methods are being called in the right environments. TEST=manual,auto storybook can start up (react 17) test site can display custom pin in both react 17 and 18
Configuration menu - View commit details
-
Copy full SHA for 0d78e7e - Browse repository at this point
Copy the full SHA 0d78e7eView commit details
Commits on Nov 4, 2022
-
Revert "use createRoot when possible for rendering pin components (#319…
…)" This reverts commit 0d78e7e.
Configuration menu - View commit details
-
Copy full SHA for f585a30 - Browse repository at this point
Copy the full SHA f585a30View commit details
Commits on Nov 9, 2022
-
display mapbox static image until the interactive map is loaded
Yen Truong committedNov 9, 2022 Configuration menu - View commit details
-
Copy full SHA for 2c8a500 - Browse repository at this point
Copy the full SHA 2c8a500View commit details
Commits on Nov 10, 2022
-
function for url, change interface
Yen Truong committedNov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for a926516 - Browse repository at this point
Copy the full SHA a926516View commit details -
add story for static image before load
Yen Truong committedNov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for 7b89a4f - Browse repository at this point
Copy the full SHA 7b89a4fView commit details -
refactor from hook to component
Yen Truong committedNov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for 0bb3220 - Browse repository at this point
Copy the full SHA 0bb3220View commit details -
mock response to be error instead of delay
Yen Truong committedNov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for 261facb - Browse repository at this point
Copy the full SHA 261facbView commit details -
remove msw setup, story use MapboxStaticImage component
Yen Truong committedNov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for 8faf428 - Browse repository at this point
Copy the full SHA 8faf428View commit details -
wait for map to load for non static map stories
Yen Truong committedNov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for 28727e4 - Browse repository at this point
Copy the full SHA 28727e4View commit details -
Yen Truong committed
Nov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for bb25f48 - Browse repository at this point
Copy the full SHA bb25f48View commit details -
Yen Truong committed
Nov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for 91089ce - Browse repository at this point
Copy the full SHA 91089ceView commit details -
Yen Truong committed
Nov 10, 2022 Configuration menu - View commit details
-
Copy full SHA for 3d5a491 - Browse repository at this point
Copy the full SHA 3d5a491View commit details
Commits on Nov 14, 2022
-
hide getCoordinate and onDrag control
Yen Truong committedNov 14, 2022 Configuration menu - View commit details
-
Copy full SHA for 2c70739 - Browse repository at this point
Copy the full SHA 2c70739View commit details -
for snapshot of dynamic map with play function
Yen Truong committedNov 14, 2022 Configuration menu - View commit details
-
Copy full SHA for 8ad916a - Browse repository at this point
Copy the full SHA 8ad916aView commit details
Commits on Nov 15, 2022
-
Merge branch 'develop' into dev/mapbox-static-image
Yen Truong committedNov 15, 2022 Configuration menu - View commit details
-
Copy full SHA for 7ab0c0c - Browse repository at this point
Copy the full SHA 7ab0c0cView commit details -
update package lock for test-site
Yen Truong committedNov 15, 2022 Configuration menu - View commit details
-
Copy full SHA for 44f0e4a - Browse repository at this point
Copy the full SHA 44f0e4aView commit details -
remove play function -- doesnt deplay snapshot
Yen Truong committedNov 15, 2022 Configuration menu - View commit details
-
Copy full SHA for def501e - Browse repository at this point
Copy the full SHA def501eView commit details
Commits on Nov 16, 2022
-
test dev wcag gh workflow with mapbox api key input
Yen Truong committedNov 16, 2022 Configuration menu - View commit details
-
Copy full SHA for 3538bfb - Browse repository at this point
Copy the full SHA 3538bfbView commit details -
Yen Truong committed
Nov 16, 2022 Configuration menu - View commit details
-
Copy full SHA for 57f505f - Browse repository at this point
Copy the full SHA 57f505fView commit details -
Yen Truong committed
Nov 16, 2022 Configuration menu - View commit details
-
Copy full SHA for 139ee22 - Browse repository at this point
Copy the full SHA 139ee22View commit details -
update workflow to point back to v1 branch, run WCAG in feature branc…
…h as well
Yen Truong committedNov 16, 2022 Configuration menu - View commit details
-
Copy full SHA for 6b48f80 - Browse repository at this point
Copy the full SHA 6b48f80View commit details
Commits on Nov 18, 2022
-
Fix wcag github action mapbox issues (#337)
paired with the changes in this [PR](yext/slapshot-reusable-workflows#22) in WCAG workflow, this PR updates the WCAG github action in the repo to pass in the mapbox key. Also updated the wcag test to exclude checking elements coming from mapbox canvas container as any potential violations coming from there is outside of our repo's control. WCAG github action also run on pull request to feature branch now. J=SLAP-2458 TEST=auto see that WCAG github action now passes
Configuration menu - View commit details
-
Copy full SHA for 06c7725 - Browse repository at this point
Copy the full SHA 06c7725View commit details -
Fix visual coverage test in Github Actions (#339)
In addition to the changes in the [workflow PR](yext/slapshot-reusable-workflows#24), this up updates run-tests github action and coverage github action to pass mapbox api key so visual coverage test works as expected. J=SLAP-2467 TEST=auto see that run-tests github action and coverage github action passed -- looked into the logs, no false positive / errors related to visual coverage.
Configuration menu - View commit details
-
Copy full SHA for 1ead573 - Browse repository at this point
Copy the full SHA 1ead573View commit details -
Yen Truong committed
Nov 18, 2022 Configuration menu - View commit details
-
Copy full SHA for ffe64e5 - Browse repository at this point
Copy the full SHA ffe64e5View commit details