-
Notifications
You must be signed in to change notification settings - Fork 174
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 the relative path bug #261
Merged
dariadomagala-sap
merged 6 commits into
SAP:master
from
dariadomagala-sap:relative-path-fix
Nov 30, 2018
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2b78cfa
Fix the relative path bug
dariadomagala-sap 7db42b4
Merge branch 'master' into relative-path-fix
dariadomagala-sap bd14207
Add comment
dariadomagala-sap ab9f2a4
Apply review changes
dariadomagala-sap 3b4ad33
Use normalizePath for consistency
dariadomagala-sap 14d93e2
Revert "Use normalizePath for consistency"
dariadomagala-sap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is safer to align the path by number of path segments. My suggestion would be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small suggestion here, for consistency and avoiding issues with leading / trailing slashes in the future or between routing strategies, I would use helper methods to normalize
nodePathSegments
andwindowPathSegments
before applying split, something like:Also what is being checked in
if (windowPathSegments.length > nodePathSegments.length - 1)
is at least for me not straightforward to understand, maybe a variable with a meaningful name would be helpful.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I removed the '-1', it was not necessary with properly prepared paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applied suggested changes :)
The only difference is that instead of
windowPath = windowPathSegments.slice(0, nodePathSegments.length).join('/');
I used
windowPath = nodePathSegments.join('/');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather stick to
windowPath = windowPathSegments.slice(0, nodePathSegments.length).join('/');
because of dynamic path segments. It might work now but in the future after a planned refactoring (because of mutating the navigation data structure that we do not want to happen) it will get broken for sure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I reverted my latest commit.