mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-27 04:46:13 +00:00
Treat plugin adapters generically in App
(#560)
Test Plan: Unit tests pass, and manual testing indicates that graph loading works. wchargin-branch: generic-plugin-adapters
This commit is contained in:
parent
3266eb31fa
commit
e492965c12
@ -134,21 +134,9 @@ export class App extends React.Component<Props, State> {
|
||||
throw new Error(`Impossible`);
|
||||
}
|
||||
|
||||
const githubPromise = new GithubAdapter()
|
||||
.load(selectedRepo)
|
||||
.then((adapter) => {
|
||||
const graph = adapter.graph();
|
||||
return {graph, adapter};
|
||||
});
|
||||
|
||||
const gitPromise = new GitAdapter().load(selectedRepo).then((adapter) => {
|
||||
const graph = adapter.graph();
|
||||
return {graph, adapter};
|
||||
});
|
||||
|
||||
Promise.all([gitPromise, githubPromise]).then((graphsAndAdapters) => {
|
||||
const graph = Graph.merge(graphsAndAdapters.map((x) => x.graph));
|
||||
const adapters = graphsAndAdapters.map((x) => x.adapter);
|
||||
const statics = [new GithubAdapter(), new GitAdapter()];
|
||||
Promise.all(statics.map((a) => a.load(selectedRepo))).then((adapters) => {
|
||||
const graph = Graph.merge(adapters.map((x) => x.graph()));
|
||||
const data = {
|
||||
graphWithMetadata: {
|
||||
graph,
|
||||
|
Loading…
x
Reference in New Issue
Block a user