-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sort the connections back into topological order after traversing runtimes #75
Conversation
// As manifest bundles may be added during runtimes we process them in reverse topological | ||
// sort order. This allows bundles to be added to their bundle groups before they are referenced | ||
// by other bundle groups by loader runtimes | ||
// Sort bundles into reverse topological order |
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.
This is topological order, not reverse
// Sort the bundles back into forward topological order | ||
let connections: Array<RuntimeConnection> = []; | ||
|
||
bundleGraph.traverseBundles({ |
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.
This isn't reverse topological order, I don't think
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.
This should be
const connections = [];
bundleGraph.traverseBundles({
exit(bundle) {
connections.push(...connectionMap.get(bundle));
}
});
connections.reverse();
@@ -192,8 +221,14 @@ export default async function applyRuntimes<TResult: RequestResult>({ | |||
} | |||
} | |||
|
|||
// Correct connection order after generating runtimes in reverse order | |||
connections.reverse(); | |||
// Sort the bundles back into forward topological order |
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're now going for reverse topological order
A while back in Parcel, we reversed the order that runtimes were processed in, so that child runtimes could be processed before parent bundles who would need to know about them. That didn't quite cut it, so we moved to reverse topological order.
This works fine for Jira, but in Confluence it causes an issue where a bundle gets loaded thinking that some of its dependencies are already loaded when they aren't.
We thought we'd fixed this with
connections.reverse()
, but that doesn't actually restore topological order, and it seems that Confluence has found the edge case.The fix here is to actually restore topological order, by processing the bundles in reverse, and then re-traversing and building up the connection list that way.