From 6517d31ebd5d79d4e3441d28ec229c47ff8a3631 Mon Sep 17 00:00:00 2001 From: Nico Schett <52858351+schettn@users.noreply.github.com> Date: Tue, 30 Nov 2021 17:54:05 +0000 Subject: [PATCH] fix(files): render snekFinder even without initBackendLink This change updates the rendering behaviour of the SnekFinder. Before the loading state of the SnekFinder was always true, unless a initBackendLink was set. Due to this, the rendering of the SnekFinder failed for all applications that did not set the initBackendLink through `jaen-pages.json` or cache. Now the loading state is set to false regardless of the initBackendLink. Without the initBackendLink, ```js localStorage.removeItem('snek-finder-osg-backend-root') ``` is called to remove the cached snekFinder data. --- packages/jaen/package.json | 18 +++++++++--------- .../jaen/src/containers/SnekFinder/index.tsx | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/jaen/package.json b/packages/jaen/package.json index 0f3b9b55..2410a91a 100644 --- a/packages/jaen/package.json +++ b/packages/jaen/package.json @@ -54,7 +54,15 @@ "react-redux": "^7.2.6", "react-use-analytics-api": "^1.4.16", "typescript": "^4.3.5", - "uuid": "^8.3.2" + "uuid": "^8.3.2", + "gatsby-alias-imports": "^1.0.6", + "gatsby-plugin-compile-es6-packages": "^2.1.1", + "gatsby-plugin-emotion": "^7.2.0", + "gatsby-plugin-image": "^2.2.0", + "gatsby-plugin-react-helmet": "^5.2.0", + "gatsby-plugin-sharp": "^4.2.0", + "gatsby-source-filesystem": "^4.2.0", + "gatsby-transformer-sharp": "^4.2.0" }, "devDependencies": { "@snek-at/storybook-addon-chakra-ui": "^1.0.0-beta.1", @@ -72,15 +80,7 @@ "babel-plugin-inline-react-svg": "^2.0.1", "babel-plugin-relative-path-import": "^2.0.1", "babel-preset-gatsby-package": "^2.2.0", - "gatsby-alias-imports": "^1.0.6", - "gatsby-plugin-compile-es6-packages": "^2.1.1", - "gatsby-plugin-emotion": "^7.2.0", - "gatsby-plugin-image": "^2.2.0", - "gatsby-plugin-react-helmet": "^5.2.0", - "gatsby-plugin-sharp": "^4.2.0", "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.24", - "gatsby-source-filesystem": "^4.2.0", - "gatsby-transformer-sharp": "^4.2.0", "isomorphic-fetch": "^3.0.0" } } diff --git a/packages/jaen/src/containers/SnekFinder/index.tsx b/packages/jaen/src/containers/SnekFinder/index.tsx index 12b48538..2f09a5ab 100644 --- a/packages/jaen/src/containers/SnekFinder/index.tsx +++ b/packages/jaen/src/containers/SnekFinder/index.tsx @@ -50,6 +50,9 @@ const Finder: React.FC = ({mode = 'browser', ...props}) => { } run() + } else { + localStorage.removeItem('snek-finder-osg-backend-root') + setLoading(false) } })