Skip to content

fix(aio): set the pageId to the file-not-found URL if the doc is not available#16085

Merged
petebacondarwin merged 1 commit intoangular:masterfrom
petebacondarwin:aio-not-found-id
Apr 19, 2017
Merged

fix(aio): set the pageId to the file-not-found URL if the doc is not available#16085
petebacondarwin merged 1 commit intoangular:masterfrom
petebacondarwin:aio-not-found-id

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

Previously, the AppComponent.pageId was set via the current URL, rather than
the document being displayed. This is only really noticeable when the URL does not
match a valid doc and we are actually displaying a 404 page.

Now we compute the pageId from the URL of the document being viewed,
which is returned from the DocumentService.currentDocument observable instead.

@petebacondarwin petebacondarwin added comp: aio action: review The PR is still awaiting reviews from at least one requested reviewer type: bug/fix labels Apr 18, 2017
@petebacondarwin
Copy link
Copy Markdown
Contributor Author

Oops I forgot to add the test of the fix 😱

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this.currentDocument --> doc (?)

Can doc really be falsy? Looking at the DocumentService, I think not.
Also, doc might not have a url property (but it might actually be a DocumentService bug).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. I think it was from a dodgy test, which I have fixed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is the logic here different than before? Was it a bug in the previous implementation (where pageId was set to home only if falsy)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Previously we were getting the url from the navigationService, which returns "" for the home page.
Now we are getting the url from the documentService, which returns "index" for the home page.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can't comment on the next line, but do we need to set a url there too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes you are right

@mary-poppins
Copy link
Copy Markdown

The angular.io preview for 7c1a895455b47769c1b6f1e4cd360548a00a2c19 is available here.

@petebacondarwin
Copy link
Copy Markdown
Contributor Author

@gkalpak PTAL

@mary-poppins
Copy link
Copy Markdown

The angular.io preview for 49c0cd0c7b33a6d94283167575af15906b734173 is available here.

@mary-poppins
Copy link
Copy Markdown

The angular.io preview for b7b94a8c49b7becb2404917ee439635f11414d56 is available here.

…available

Previously, the `AppComponent.pageId` was set via the current URL, rather than
the document being displayed. This is only really noticeable when the URL does not
match a valid doc and we are actually displaying a 404 page.

Now we compute the `pageId` from the  URL of the document being viewed,
which is returned from the  `DocumentService.currentDocument` observable instead.
@mary-poppins
Copy link
Copy Markdown

The angular.io preview for f3e6812 is available here.

@petebacondarwin petebacondarwin merged commit e951612 into angular:master Apr 19, 2017
@petebacondarwin petebacondarwin deleted the aio-not-found-id branch April 19, 2017 08:09
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer cla: yes type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants