From 559020d21c2e6c6c2179b99dff5f5be9d7be42fe Mon Sep 17 00:00:00 2001 From: Doug Martin Date: Wed, 26 Jun 2024 11:45:30 -0400 Subject: [PATCH] build: Update lara-interactive-api to latest version [PT-187855291] This was using a *very* old version but shockingly it worked. This needs to be update to the latest version as the api is going to be updated to enable time series data sets. --- package-lock.json | 6 +++--- package.json | 2 +- src/lara-app/hooks/interactive-api.ts | 29 +++++++++++++++------------ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3866887..8b29774 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1983,9 +1983,9 @@ } }, "@concord-consortium/lara-interactive-api": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/@concord-consortium/lara-interactive-api/-/lara-interactive-api-0.7.1.tgz", - "integrity": "sha512-rElnC5iTSE9wKgDzTMKXS73oJ0F2/wJgF+Ufsg7yvZb7D6hQJto01pXVi9PR+eXj4UsxGVnvuN0mUZVUYjOVwQ==", + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@concord-consortium/lara-interactive-api/-/lara-interactive-api-1.9.4.tgz", + "integrity": "sha512-KzwrCFs56t+TRoC7OVDXGRXRuyl+QS1+SE0LpXoihfCPKnJrvAUjmzEQt+TXdTRXjZLwa1stIbXlMzzS9MRmmw==", "requires": { "iframe-phone": "^1.3.1" }, diff --git a/package.json b/package.json index c17e2a9..dcd399f 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "webpack-dev-server": "^3.10.1" }, "dependencies": { - "@concord-consortium/lara-interactive-api": "^0.7.1", + "@concord-consortium/lara-interactive-api": "^1.9.4", "@concord-consortium/lara-plugin-api": "^3.1.2", "@concord-consortium/token-service": "^1.2.0", "@vernier/godirect": "^1.8.3", diff --git a/src/lara-app/hooks/interactive-api.ts b/src/lara-app/hooks/interactive-api.ts index 7f29733..5959463 100644 --- a/src/lara-app/hooks/interactive-api.ts +++ b/src/lara-app/hooks/interactive-api.ts @@ -70,20 +70,23 @@ export const useInteractiveApi = (options: {setError: (error: any) => void}) => setConnectedToLara(true); let _experiment; - let authoredState = data.authoredState; - // In authoring mode the authored state comes in as a string - // which causes the authoring preview to show an error - if (typeof authoredState === "string") { - try { - authoredState = JSON.parse(authoredState); - } catch (e) { - // noop + + if (data.mode !== "reportItem") { + let authoredState = data.authoredState; + // In authoring mode the authored state comes in as a string + // which causes the authoring preview to show an error + if (typeof authoredState === "string") { + try { + authoredState = JSON.parse(authoredState); + } catch (e) { + // noop + } + } + if (authoredState?.version === "1.0") { + experimentId.current = authoredState.experimentId; + _experiment = findExperiment(authoredState.experimentId); + setExperiment(_experiment); } - } - if (authoredState?.version === "1.0") { - experimentId.current = authoredState.experimentId; - _experiment = findExperiment(authoredState.experimentId); - setExperiment(_experiment); } let interactiveState: IInteractiveStateJSON | undefined;