Skip to content

Commit

Permalink
Don't use the content if in add form
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Jun 11, 2024
1 parent bd4f151 commit f37a78f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Widgets/VisualizationWidget.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useMemo } from 'react';
import { withRouter } from 'react-router';
import { connect } from 'react-redux';
import { compose } from 'redux';
Expand All @@ -20,6 +20,7 @@ import '@eeacms/volto-tableau/less/tableau.less';
const VisualizationWidget = (props) => {
const { location, content } = props;
const ogValue = props.value || {};
const inAddForm = props.location.pathname.split('/').pop() === 'add';
const viz = React.useRef();
const [schema, setSchema] = React.useState(null);
const [vizState, setVizState] = React.useState({
Expand All @@ -34,7 +35,7 @@ const VisualizationWidget = (props) => {
getTableauVisualization({
isBlock: false,
content: {
...content,
...(inAddForm ? {} : content),
tableau_visualization: value,
},
}),
Expand Down Expand Up @@ -76,12 +77,12 @@ const VisualizationWidget = (props) => {
getTableauVisualization({
isBlock: false,
content: {
...content,
...(inAddForm ? {} : content),
tableau_visualization: value,
},
}),
);
}, [content, value]);
}, [content, value, inAddForm]);

/**
* Update query
Expand Down

0 comments on commit f37a78f

Please sign in to comment.