diff --git a/CHANGELOG.md b/CHANGELOG.md index 12967ca..482b1ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed ### Fixed + - Fixed frontend crash when instance node missing ### Security diff --git a/backend/config/dev.exs b/backend/config/dev.exs index f17d478..53d1f3d 100644 --- a/backend/config/dev.exs +++ b/backend/config/dev.exs @@ -57,8 +57,8 @@ config :backend, Backend.Repo, pool_size: 10 config :backend, :crawler, - status_age_limit_days: 28, - status_count_limit: 1000, + status_age_limit_days: 14, + status_count_limit: 500, personal_instance_threshold: 5, crawl_interval_mins: 60, crawl_workers: 10, diff --git a/frontend/src/components/molecules/Cytoscape.tsx b/frontend/src/components/molecules/Cytoscape.tsx index 468e5ae..4de8b0a 100644 --- a/frontend/src/components/molecules/Cytoscape.tsx +++ b/frontend/src/components/molecules/Cytoscape.tsx @@ -40,7 +40,7 @@ class Cytoscape extends React.PureComponent { this.cy = cytoscape({ autoungrabify: true, container: container as any, - elements: this.props.elements, + elements: this.cleanElements(this.props.elements), hideEdgesOnViewport: true, hideLabelsOnViewport: true, layout: { @@ -341,6 +341,16 @@ class Cytoscape extends React.PureComponent { } this.cy.edges().addClass("hidden"); }; + + /* Helper function to remove edges if source or target node is missing */ + private cleanElements = (elements: cytoscape.ElementsDefinition): cytoscape.ElementsDefinition => { + const domains = new Set(elements.nodes.map(n => n.data.id)); + const edges = elements.edges.filter(e => domains.has(e.data.source) && domains.has(e.data.target)); + return { + edges, + nodes: elements.nodes + }; + }; } export default Cytoscape;