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 - Site crashes after user searches property #1043

Open
CodeWritingCow opened this issue Dec 11, 2024 · 3 comments
Open

Bug - Site crashes after user searches property #1043

CodeWritingCow opened this issue Dec 11, 2024 · 3 comments
Assignees
Labels
bug Something isn't working frontend high priority

Comments

@CodeWritingCow
Copy link
Collaborator

CodeWritingCow commented Dec 11, 2024

Describe the bug
When a user looks up a property and then clicks a link in the navbar, the web application crashes and shows a client-side error screen.

2117-e0c701d8057c2152.js:1 TypeError: Cannot read properties of undefined (reading 'getSource')
    at rx.getSource (05f6971a-22d488b7be83c68e.js:51:205574)
    at y (8556-344b47f3e82064cf.js:2:30526)
    at Object.setMarkers (8556-344b47f3e82064cf.js:2:31112)
    at n (8556-344b47f3e82064cf.js:2:72895)
    at f (8556-344b47f3e82064cf.js:2:32930)
    at Array.forEach (<anonymous>)
    at p (8556-344b47f3e82064cf.js:2:32990)
    at Q (8556-344b47f3e82064cf.js:2:35375)
    at eX.$destroy (8556-344b47f3e82064cf.js:2:36356)
    at push.94205.n.current.e.<computed>.n.current.$set (

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://cleanandgreenphilly.org/find-properties/884341730
  2. Click on any link in navbar
  3. See error

Expected behavior
When user clicks a navbar link, it should take them to the correct page without crashing.

Screen recording

Site.crashes.after.user.searches.property.mov

Screenshots
Error screen
Screen Shot 2024-12-10 at 7 05 03 PM

Error message in browser console
Screen Shot 2024-12-10 at 7 05 19 PM

Desktop (please complete the following information):

  • OS: MacOS Monterey v12.7.6
  • Browser Chrome
  • Version 131.0.6778.109

Additional context
Reported by @brandonfcohen1 on Clean & Green Philly's Slack channel

@CodeWritingCow CodeWritingCow self-assigned this Dec 11, 2024
@CodeWritingCow CodeWritingCow changed the title Bug - Site crashes after user searches a specific property Bug - Site crashes after user searches property Dec 11, 2024
@CodeWritingCow
Copy link
Collaborator Author

Running the app locally with the latest code from main branch, I was able to replicate the bug and see more detailed error messages. It appears the error might be related to maplibre or a recently installed dependency, maptiler/geocoding-control.

Error screen in local env:

Screen Shot 2024-12-10 at 9 25 11 PM

Screen Shot 2024-12-10 at 9 25 21 PM

Console error messages in local env:

Screen Shot 2024-12-10 at 9 27 44 PM
Screen Shot 2024-12-10 at 9 28 12 PM
Screen Shot 2024-12-10 at 9 27 07 PM
Screen Shot 2024-12-10 at 9 26 53 PM
Screen Shot 2024-12-10 at 9 25 58 PM

So getSource is a maplibre-gl.js method:

Screen Shot 2024-12-10 at 9 30 49 PM
Screen Shot 2024-12-10 at 9 30 41 PM

This gives a better idea of what might be causing the bug. I'll continue looking into this.

@CodeWritingCow
Copy link
Collaborator Author

In production env (AKA the live website), I used a debugger in Google Chrome's DevTools to see what getSource is doing.

When user first navigates to find-properties page, getSource() is passed vacant-properties-tiles as the argument:

Screen Shot 2024-12-10 at 9 17 25 PM

As the find-properties page loads, getSource() is passed full-geom as the argument:

Screen Shot 2024-12-10 at 9 19 08 PM

Finally, user goes to get-access page. As the page loads (and before it crashes), getSource() is passed full-geom as the argument:

Screen Shot 2024-12-10 at 9 21 07 PM

Perhaps this is related to the bug. It could also be a red herring.

@CodeWritingCow CodeWritingCow moved this to In Development in Clean & Green Philly Dec 11, 2024
@CodeWritingCow
Copy link
Collaborator Author

So the bug is caused by changes to Mapbox in PRs #1003 and #1008. I confirmed this by visiting the Vercel preview env for PR 1003 at https://vacant-lots-proj-13xrykfdy-clean-and-green-philly.vercel.app/

I also visited the Vercel preview envs for other front-end PRs submitted around the same time as PR 1003. The error did not occur in the Vercel preview envs for those PRs:

The solution is to revert PRs 1003 and 1008. I tested this in my local env, and the error was not happening locally.

Screen recording

Here is a video recording of the error happening in Vercel preview env for 1003:

issue.1043.-.bug.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend high priority
Projects
Status: Live
Development

No branches or pull requests

1 participant