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

Deduplicate m.route and m.redraw logic #2453

Merged
merged 1 commit into from
Jul 5, 2019

Conversation

dead-claudia
Copy link
Member

@dead-claudia dead-claudia commented Jul 5, 2019

Description

  • Remove appropriate route change subcriptions when a root is removed via m.mount(root, null).
  • Don't pollute onpopstate and friends - use standard event listeners instead.
  • Simplify and streamline subscriptions, in preparation of adding a remove parameter to m.mount.
  • Change the redraw internals to redraw immediately, with ability to cancel via returning a sentinel.
  • Change "bleeding-edge" for m.version in next to instead just be the latest m.version. (If you're using next, you should know what you're in for.)
  • Update tests to be aware of these changes. (Some were failing for subtle reasons.)
  • Drive-by: remove some uses of string.charAt(n) and use string[n] instead.

Motivation and Context

Fixes #2437.

Also, this addresses a couple things that have been in discussion for a while.

How Has This Been Tested?

Added new tests, updated a lot of tests.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated docs/change-log.md

@project-bot project-bot bot added this to Needs triage in Triage/bugs Jul 5, 2019
- Remove appropriate route change subcriptions when a root is removed
  via `m.mount(root, null)`.
- Don't pollute `onpopstate` and friends - use standard event listeners
  instead.
- Simplify and streamline subscriptions, in preparation of adding a
  `remove` parameter to `m.mount`.
- Change the redraw internals to redraw immediately, with ability to
  cancel via returning a sentinel.
- Change `"bleeding-edge"` for `m.version` in `next` to instead just be
  the latest `m.version`. (If you're using `next`, you should know what
  you're in for.)
- Update tests to be aware of these changes. (Some were failing for
  subtle reasons.)
- Drive-by: remove some uses of `string.charAt(n)` and use `string[n]`
  instead.
@dead-claudia dead-claudia merged commit 90bcff0 into MithrilJS:next Jul 5, 2019
Triage/bugs automation moved this from Needs triage to Closed Jul 5, 2019
@dead-claudia dead-claudia deleted the route-mount-deduplicate branch July 5, 2019 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Removal of mithril event listeners when navigating away from a mithril app
1 participant