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

TypeError: Cannot read properties of undefined (reading 'isOpen') in MediaImageCarousel.vue #980

Open
2 tasks done
mattburnett-repo opened this issue Sep 29, 2024 · 4 comments
Assignees
Labels
bug Something isn't working hacktoberfest Included as a part of Hacktoberfest

Comments

@mattburnett-repo
Copy link
Contributor

mattburnett-repo commented Sep 29, 2024

Terms

Behavior

A quick summary:

  • The error in the title appears in the dev tools console when navigating away from a page. This is the primary issue.
  • It is possible that this is due to unnecessary 'handleCloseModal' methods in some of the codebase. This is a secondary issue, and is perhaps better handled in a separate bug report / issue.

Steps to reproduce:

  • Start at homepage.
  • Click 'View Organizations'.
  • Click any of the displayed organizations.
  • Once the clicked organization is displayed, navigate away from the org by clicking 'Back'.
  • Error appears in dev tools console.

Notes (why this might be happening, things tried that didn't work, etc):

  • There is a watch() method at the end of ModalBase.vue (line 100) that calls the closeModal() method if the user has navigated away from a page.
    • This happens whether any modals are open or not. I think this is the cause of the primary issue, and is simple to fix.
  • closeModal() emits a "closeModal" event. Sometimes this is needed so that an affected modal can do cleanup to itself (eg. CommandPalette).
  • It looks like there are components in the codebase that could be receiving this "closeModal" event. Additionally, there is duplicate code to handle "closeModal" events in these components. It's possible that these components are trying to close a modal window that is not open. This would cause the error.
    • Relevant example is in MediaImageCarousel.vue, line 33 and line 64.

So there are two issues:
1 The closeModal() method is triggered every time a user navigates around the app, whether there is an open modal or not.
2 There is duplicate code in some components that handles modal closing outside of ModalBase.vue. ModalBase should be the only place where modals are closed.

I suggest that the primary issue (issue 1) be resolved first and then be sent through the PR process. Once the PR is closed, the secondary issue (issue 2) should be addressed.

I'm happy to take this on. Let me know if this approach is appropriate, or if another approach is preferred.

@mattburnett-repo mattburnett-repo added the bug Something isn't working label Sep 29, 2024
@andrewtavis
Copy link
Member

Thanks for mapping this out, @mattburnett-repo! @momanyisamuel and I were seeing much of this earlier today. By all means feel free to take this on :)

@andrewtavis
Copy link
Member

Let's definitely handle issue 1 first and move to the second as you sugguested!

@mattburnett-repo
Copy link
Contributor Author

Created local branch 980.2, in order to address the secondary issue in this bug report (possible duplicate modal-handling code in some of the codebase). Once this secondary issue is addressed, another PR for this bug report will arrive.

@andrewtavis
Copy link
Member

Thanks @mattburnett-repo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest Included as a part of Hacktoberfest
Projects
Status: In Progress
Development

No branches or pull requests

2 participants