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

fix(router-plugin): resolve infinite redirects and browser hanging #1430

Merged
merged 5 commits into from
Nov 20, 2019

Conversation

arturovt
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #1293 #1407

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[ ] No

Other information

@splincode
Copy link
Member

You are the best!!!

Copy link
Member

@markwhitfeld markwhitfeld left a comment

Choose a reason for hiding this comment

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

Great work! Just some small tweaks and questions

"baseUrl": "./",
"module": "es2015",
"types": []
"module": "esnext"
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to move away from the default bootstrapped config?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should not touch these configs during this PR. I touched it because dynamic import is a part of the esnext system.

Copy link
Member

Choose a reason for hiding this comment

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

Have we done dynamic imports in the ng5 sample?
Would this be part of typical ng5 code?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's part of TS itself, not ng5.

packages/router-plugin/src/router.module.ts Show resolved Hide resolved
packages/router-plugin/src/router.state.ts Outdated Show resolved Hide resolved
@markwhitfeld
Copy link
Member

I would really like to get this into the v3.6 release!

@arturovt arturovt added this to the v3.6.0 milestone Nov 1, 2019
jest.config.js Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
@markwhitfeld
Copy link
Member

More changes coming after last night's hectic debugging session!

@splincode
Copy link
Member

@markwhitfeld please see it, we need it in release

Copy link
Member

@markwhitfeld markwhitfeld left a comment

Choose a reason for hiding this comment

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

Can we restore some of these tests?
Are you happy that the issue is solved? You had some issues after our debugging session... were you able to resolve them?

} from '../';

describe('NgxsRouterPlugin', () => {
it('should dispatch router state events', fakeAsync(async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we restore this test?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure. This test is not explicit and we always have to fix it when we do any change. I don't think it's a good approach.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we could restore this test but run expectations on other things, not logs.

Copy link
Member

Choose a reason for hiding this comment

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

This type of test is often called a characterization test. It is not necessarily saying that the behavior is right or wrong but rather just documenting what the current behavior is. The value here is to know what has changed when it does.
You could suffix the test name with "(Characterization)" to make its value explicit.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will move it to another file for this type of tests to avoid mess.

]);
}));

it('should dispatch router state events for another route', fakeAsync(async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we restore this test?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure. This test is not explicit and we always have to fix it when we do any change. I don't think it's a good approach.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we could restore this test but run expectations on other things, not logs.

Copy link
Member

@markwhitfeld markwhitfeld Nov 14, 2019

Choose a reason for hiding this comment

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

See other comment about Characterization tests

@@ -231,304 +168,6 @@ describe('NgxsRouterPlugin', () => {
const state = TestBed.get(Store).selectSnapshot(TestState);
expect(state).toBeTruthy();
expect(state.url).toEqual('/testpath');
}));

describe('RouterDataResolved', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we restore this fixture? Or has it moved?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was moved to another file.

Copy link
Member

@markwhitfeld markwhitfeld Nov 14, 2019

Choose a reason for hiding this comment

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

Ah, thanks! Did any tests disappear from this fixture in the move?

@markwhitfeld
Copy link
Member

markwhitfeld commented Nov 19, 2019

@arturovt I would love to get this into the next release. Could you make the small tweaks above and add a section about this to the announcement article (as part of this PR) if it is not there yet?

@arturovt
Copy link
Member Author

I'm very busy. I will try to find a chance to push those changes at weekends.

@markwhitfeld
Copy link
Member

@arturovt Should I merge this PR and then you can make the further changes (regarding the tests) on this branch and submit another PR?

@arturovt
Copy link
Member Author

As you wish. If you think that those changes, that we've made while debugging, are OK, then you can go with merging.

@markwhitfeld markwhitfeld merged commit 6c6c6b3 into master Nov 20, 2019
@arturovt arturovt deleted the fix/issues-1293-1407 branch November 20, 2019 20:23
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