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

feat(history-service): support multiple location changes in one navigation #496

Closed

Conversation

stemey
Copy link
Collaborator

@stemey stemey commented May 20, 2019

  • add RootHistoryService

Copy link
Member

@clebert clebert left a comment

Choose a reason for hiding this comment

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

I only reviewed createRootLocationTransformer including tests. I noticed that TSLint and Prettier were not used and the CI/CD did not pass. Please revise your code so that it meets all formal quality criteria. After that I will continue with the content review. In general, this PR should also include adjustments to the History Service documentation on FeatureHub.io: https://feature-hub.io/docs/guides/sharing-the-browser-history

Despite all my comments, thank you for your contribution to this project!

.idea/feature-hub.iml Outdated Show resolved Hide resolved
...consumerLocations: ConsumerLocation[]
): history.Location {
if (options.primaryConsumerUid && !consumerLocations.some((consumerLocation) => consumerLocation.historyKey===options.primaryConsumerUid)) {
throw new Error('primary consumer is mandatory')
Copy link
Member

Choose a reason for hiding this comment

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

When writing the error messages, please follow the style that prevails in this project. The first letter is capitalized and we have punctuation.

Copy link
Member

Choose a reason for hiding this comment

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

And please add a test for this error, we expect your code to have 100% test coverage.

consumerLocation.location,
rootlocation,
consumerLocation.historyKey
) as history.Location;
Copy link
Member

Choose a reason for hiding this comment

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

This cast is not correct and obscures potential errors. Shouldn't the return value of the method rather be "LocationDescriptorObject"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, we should change ConsumerLocation type. It should contain LocationDescriptorObject. We don't even support hash for any consumer but the primary. I am not sure if we should handle parameters and paths - path is usually enough and could be encoded much easier

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And what about the key in Location? We cannot properly multiplex that, I guess. It probably doesn't have a meaning for a consumer history. All appearances of Location in the consumerHistory should be cleaned up and a custom Location type without key should be used. I think the key is currently ignored completely.

@@ -22,6 +27,10 @@ export interface RootLocationTransformer {
currentRootLocation: history.Location,
consumerUid: string
): history.LocationDescriptorObject;

createLocation(
Copy link
Member

Choose a reason for hiding this comment

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

We should find a better name for this method. How about createRootLocationForMultipleConsumers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@stemey stemey force-pushed the feat/multiple-location-transformer branch from dfc5628 to cad9730 Compare May 24, 2019 14:36
@stemey stemey force-pushed the feat/multiple-location-transformer branch 2 times, most recently from 7a56de9 to 803ff7f Compare June 12, 2019 10:08
@stemey stemey force-pushed the feat/multiple-location-transformer branch 4 times, most recently from 65d7ac6 to ca40207 Compare June 24, 2019 11:19
…ation

- add RootHistoryService

fix(history-service): new API

fix(history-service): remove idea files

fix(history-service): fix linter errors and add tests

fix(history-service): isssues
@stemey stemey force-pushed the feat/multiple-location-transformer branch from ca40207 to e75e253 Compare June 24, 2019 12:06
unstubbable added a commit that referenced this pull request Jun 27, 2019
…ation

Co-authored-by: Stefan Meyer <stefan.meyer@sinnerschrader.com>

closes #496
fixes #441
unstubbable added a commit that referenced this pull request Jun 27, 2019
…ation

closes #496
fixes #441

Co-authored-by: Stefan Meyer <stefan.meyer@sinnerschrader.com>
@stemey stemey closed this Jul 2, 2019
unstubbable added a commit that referenced this pull request Jul 4, 2019
…ation

closes #496
fixes #441

Co-authored-by: Stefan Meyer <stefan.meyer@sinnerschrader.com>
unstubbable added a commit that referenced this pull request Jul 5, 2019
…ation (#518)

closes #496
fixes #441

Co-authored-by: Stefan Meyer <stefan.meyer@sinnerschrader.com>
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.

None yet

2 participants