@eeacms/volto-tableau 6.0.2 → 6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,12 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [6.0.3](https://github.com/eea/volto-tableau/compare/6.0.2...6.0.3) - 10 November 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - fix tableau for real this time [Miu Razvan - [`a304c2c`](https://github.com/eea/volto-tableau/commit/a304c2cce2a68cfa6b1123a853cfda0b57501ab3)]
7
12
  ### [6.0.2](https://github.com/eea/volto-tableau/compare/6.0.1...6.0.2) - 10 November 2023
8
13
 
9
14
  #### :rocket: New Features
10
15
 
11
16
  - feat: fix tableau not loading on hard reload [Miu Razvan - [`f37867f`](https://github.com/eea/volto-tableau/commit/f37867f3d07c5dd05b91ea0b758eced631afd458)]
12
- - feat: mobile toolbar [Miu Razvan - [`d4f0812`](https://github.com/eea/volto-tableau/commit/d4f08122a743f4787177d6d2bc3aabeebf6bf311)]
13
17
 
14
18
  ### [6.0.1](https://github.com/eea/volto-tableau/compare/6.0.0...6.0.1) - 10 November 2023
15
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tableau",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "@eeacms/volto-tableau: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -333,7 +333,6 @@ const Tableau = forwardRef((props, ref) => {
333
333
  }, [data]);
334
334
 
335
335
  useEffect(() => {
336
- // console.log('HERE trigger initiateViz', tableau, url);
337
336
  if (!tableau) return;
338
337
  if (url) {
339
338
  disposeViz();
package/src/hooks.js CHANGED
@@ -1,11 +1,10 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useEffect, useState, useRef } from 'react';
2
2
  import { loadTableauScript } from './helpers';
3
3
 
4
- let clock;
5
-
6
4
  const TIMEOUT = 10000;
7
5
 
8
6
  export const useTableau = (version) => {
7
+ const clock = useRef();
9
8
  const [tableau, setTableau] = useState();
10
9
 
11
10
  useEffect(() => {
@@ -13,20 +12,20 @@ export const useTableau = (version) => {
13
12
 
14
13
  const startTime = new Date().getTime();
15
14
 
16
- clock = setInterval(() => {
15
+ clock.current = setInterval(() => {
17
16
  const tableauApi = window[`tableau_${version}`];
18
17
  if (tableauApi) {
19
18
  setTableau(tableauApi);
20
- clearInterval(clock);
19
+ clearInterval(clock.current);
21
20
  return;
22
21
  }
23
22
  if (new Date().getTime() - startTime > TIMEOUT) {
24
- clearInterval(clock);
23
+ clearInterval(clock.current);
25
24
  }
26
25
  }, 100);
27
26
 
28
27
  return () => {
29
- clearInterval(clock);
28
+ clearInterval(clock.current);
30
29
  };
31
30
  }, [version]);
32
31