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

Match media testing guard and bug fix #470

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Oct 12, 2023

Description

  • Adds an additional guard to prevent attempting to access the window.matchMedia API when it is in an environment that it is not supported
  • Fixes a hitherto unnoticed bug, whereby the use of a JS getter to return the value of window.matchMedia meant that removing event listeners was doing nothing, as the getter was returning a new instance each time (and so was not unbinding the listener from the instance that it had actually been bound to).
  • Does this by caching the window.matchMedia result call, to minimize code changes and to continue to allow delay of instantiation of the mediaQueryList object.

Issue addressed

Fixes failing tests seen in develop on Kolibri
Fixes unreported bug that would stop listeners from being unbound

Testing checklist

  • The change has been added to the changelog

@@ -47,6 +47,17 @@ Changelog is rather internal in nature. See release notes for the public overvie

## Version 2.0.0

- [#470]
Copy link
Member

Choose a reason for hiding this comment

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

Could you please move this istem to the "Upcoming version"?

The current items in the "Version 2.0.0" are already released. I will rename this section to "Version 2.0.0-beta0 (released)" to make it clearer. If you have some others ideas of what may help, let me know.

Copy link
Member

Choose a reason for hiding this comment

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

For now I updated the changelog in this way
Screenshot from 2023-10-13 12-32-27

Copy link
Member Author

Choose a reason for hiding this comment

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

From my experience looking through dependency updates for many different JS packages - I have found the style of having changes only mentioned in alphas, betas, and rcs and not in the final release much more difficult to parse, especially when looking for breaking changes. I'd recommend not separating the changelog in this way, and see the beta releases as try outs for what the final release will be.

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense and will be ideal in the long term.

This is temporary only to help us now when we're in the transition towards re-introducing a stable release process. We already have beta with release notes so that we can start introducing and regression testing. Without them, it'd be difficult because we were postponing releases and accumulated lots of breaking changes. So release notes were created in advance and with that we will need to keep track for some time what other changes need to be eventually added.

This should get better with more frequent releases. With @marcellamaki and @thanksameeelian, we decided to cleanup the release notes from all betas and merge them for the final release as soon as it's ready so that should address it. On that occasion we can do one last changelog cleanup and merge all sections for v2.

cc @thanksameeelian @marcellamaki

Copy link
Member

@MisRob MisRob Oct 16, 2023

Choose a reason for hiding this comment

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

Alternatively, we could just add a comment to the changelog to indicate where the release notes end. I tried something like that already, but it seems it's hard to notice for devs. In any case, I'd be okay with any (shared) way of making it easier for us to track where the existing release notes end in the changelog, if you have any other ides.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will rebase now to move this.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

Code additions look correct to me. Thanks @rtibbles

@rtibbles
Copy link
Member Author

Updated!

@MisRob
Copy link
Member

MisRob commented Oct 19, 2023

I wanted to note that I only jumped in to notify about changelog, but didn't review myself. If there is anything needed from my side, let me know.

@rtibbles
Copy link
Member Author

Rebased again to resolve the CHANGELOG merge conflict.

At the risk of sounding needy, I do need approval - the changes are fairly straight forward so would be a quick review.

@MisRob
Copy link
Member

MisRob commented Oct 19, 2023

I assume that @akolson review was meant as approval so marking it green. Please reach out if anything @akolson

@MisRob
Copy link
Member

MisRob commented Oct 19, 2023

I skimmed it too now and haven't noticed anything blocking. Leaving only one minor note.

@rtibbles rtibbles merged commit 0444139 into learningequality:main Oct 20, 2023
7 checks passed
@rtibbles rtibbles deleted the no_match_media branch October 20, 2023 16:08
- **Description:** Fix bug and add test guard in MediaQuery implementation
- **Products impact:** none
- **Addresses:** -
- **Components:** none
Copy link
Member

Choose a reason for hiding this comment

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

Just a note that here, all affected components would ideally be included here even though it doesn't modify them directly, it's something that's used under the hood (this will help with the release notes).

Copy link
Member

Choose a reason for hiding this comment

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

No need to do anything about it, I already prepared the release notes for this item too. Just jumping into PRs and using them as spreading the word.

@@ -6,6 +6,17 @@ Changelog is rather internal in nature. See release notes for the public overvie

<!-- All new changelog items should come here -->

- [#470]
- **Description:** Fix bug and add test guard in MediaQuery implementation
- **Products impact:** none
Copy link
Member

@MisRob MisRob Oct 23, 2023

Choose a reason for hiding this comment

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

Here, the product impact would be bugfix. Here's an example of release notes for useKResponsiveWindow. We'd ideally be able to read this from the changelog rather than opening a PR link and studying it. As mentioned below, no action needed.

Screenshot from 2023-10-23 13-34-29

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.

3 participants