Skip to content

Reinstate the "prevent unwanted clearInterval" PR #3225

Closed
@cartant

Description

@cartant

I left a comment on the PR that reverted PR #3044. After Zone.js 0.8.19 was released I looked into the reported Angular problem and discovered that PR #3044 was not the cause.

The comment is repeated below.


FYI, the problem with 5.5.3 is unrelated to PR #3044 and it was not the reversion of that PR that solved the problem of Angular's routing module effecting an EmptyError.

Instead, the problem appears to have been the way in which the .js files in 5.5.3 were generated.

I can reproduce the effected error by taking the util/EmptyError.js file from 5.5.3 and overwriting the file in the 5.5.2 distribution.

In fact, if you look at the files that are incorporated into the Plunk, you will see that scheduler/AsyncAction.js - the file modified in PR #3044 - does not even form part of the build.

The 5.5.2 EmptyError.js file looks like this:

"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
 * An error thrown when an Observable or a sequence was queried but has no
 * elements.
 *
 * @see {@link first}
 * @see {@link last}
 * @see {@link single}
 *
 * @class EmptyError
 */
var EmptyError = (function (_super) {
    __extends(EmptyError, _super);
    function EmptyError() {
        var err = _super.call(this, 'no elements in sequence');
        this.name = err.name = 'EmptyError';
        this.stack = err.stack;
        this.message = err.message;
    }
    return EmptyError;
}(Error));
exports.EmptyError = EmptyError;
//# sourceMappingURL=EmptyError.js.map

Whereas the 5.5.3 EmptyError.js file looks like this:

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * An error thrown when an Observable or a sequence was queried but has no
 * elements.
 *
 * @see {@link first}
 * @see {@link last}
 * @see {@link single}
 *
 * @class EmptyError
 */
var EmptyError = /** @class */ (function (_super) {
    __extends(EmptyError, _super);
    function EmptyError() {
        var _this = this;
        var err = _this = _super.call(this, 'no elements in sequence') || this;
        _this.name = err.name = 'EmptyError';
        _this.stack = err.stack;
        _this.message = err.message;
        return _this;
    }
    return EmptyError;
}(Error));
exports.EmptyError = EmptyError;
//# sourceMappingURL=EmptyError.js.map

The EmptyError implementation in 5.5.3 seems to mess with this instanceof test in Angular's router.

Why the two generated files differ, I have no idea. The EmptyError.js generated for 5.5.4 is identical to that generated for 5.5.2, yet there appear to be no configuration changes between 5.5.3 and 5.5.4, so I can only presume that the build environment for 5.5.3 was not what it should have been.

The Zone.js bug - in the PR that I referenced above - does not effect the EmptyError. The bug is related to my PR, as there was a (far more subtle) problem with Zone.js and setInterval, but that has been fixed with the release of version 0.8.19 of Zone.js.

Given that the reported problem was unrelated to the reverted PR and that the PR fixes a problem with intervals drifting (see this issue and this SO question) I think the commit should be reinstated. If not into stable, then definitely into master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions