Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Stable sort #215

Merged
merged 2 commits into from
Mar 25, 2018
Merged

Stable sort #215

merged 2 commits into from
Mar 25, 2018

Conversation

Rich-Harris
Copy link
Member

Found a situation in which route sorting could be unstable, resulting in incorrect navigation. This fixes it. Also includes an unrelated commit I'd forgotten about, which binds store to error pages

@Rich-Harris Rich-Harris merged commit 72c27b7 into master Mar 25, 2018
@Rich-Harris Rich-Harris deleted the stable-sort branch March 25, 2018 19:19
@@ -102,7 +102,10 @@ export default function create_routes({ files } = { files: glob.sync('**/*.*', {
}

if (!a_sub_part.dynamic && a_sub_part.content !== b_sub_part.content) {
return b_sub_part.content.length - a_sub_part.content.length;
return (
(b_sub_part.content.length - a_sub_part.content.length) ||
Copy link
Contributor

@thgh thgh Mar 25, 2018

Choose a reason for hiding this comment

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

Why not only alphabetically?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because a/b/foo.html needs to match before a/b/f[xx].html

Copy link
Contributor

Choose a reason for hiding this comment

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

OK I see now 😄 thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants