From d69f3d0eec29d1d1aeb725b97de3a5209f85447a Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Tue, 16 Apr 2024 06:50:13 +1200 Subject: [PATCH] Fix bug where import after error continues failing (#463) Steps to reproduce: 1. Open https://www.speedscope.app/ 2. Try to import an invalid file such as [invalid.json](https://github.com/jlfwong/speedscope/files/14167326/invalid.json). The page says "Something went wrong. Check the JS console for more details." 3. Now try to import a valid file such as [simple.json](https://github.com/jlfwong/speedscope/files/14167335/simple.json). The page says "Something went wrong. Check the JS console for more details." even though this second file is valid. Explanation of the fix (copied from the commit message): > We need to clear the error flag, otherwise once there is an error and we display "Something went wrong" we will keep displaying that forever even when the user imports a valid file. --- src/views/application.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/application.tsx b/src/views/application.tsx index d3fba1547..d51c4d83b 100644 --- a/src/views/application.tsx +++ b/src/views/application.tsx @@ -168,6 +168,7 @@ export type ApplicationProps = { export class Application extends StatelessComponent { private async loadProfile(loader: () => Promise) { + this.props.setError(false) this.props.setLoading(true) await new Promise(resolve => setTimeout(resolve, 0))