Got graph rendering working again, always using the state after the previous query. It even has a bit of error handling now.