Skip to content

Commit

Permalink
Merge pull request #804 from mediacloud/multi-query-error-bug
Browse files Browse the repository at this point in the history
Multi query error bug fix
  • Loading branch information
Evan-Leon authored Sep 30, 2024
2 parents 66d97c2 + 00af54d commit 970edcb
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions mcweb/frontend/src/features/search/TabbedSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export default function TabbedSearch() {
{queryState.map((query, i) => (
<Tab
disableRipple
// eslint-disable-next-line react/no-array-index-key
key={i}
sx={{ marginRight: 0.5 }}
style={{ outline: `4px solid ${color[i]}`, outlineOffset: '-4px', borderRadius: '4px' }}
Expand Down Expand Up @@ -248,6 +249,7 @@ export default function TabbedSearch() {
</Box>

{queryState.map((query, i) => (
// eslint-disable-next-line react/no-array-index-key
<TabPanelHelper key={i} value={value} index={i}>
<Search queryIndex={i} />
</TabPanelHelper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
export default function CountOverTimeResults() {
const dispatch = useDispatch();
const queryState = useSelector((state) => state.query);

const {
platform,
initialSearchTime,
Expand Down
3 changes: 2 additions & 1 deletion mcweb/frontend/src/features/search/results/SampleStories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export default function SampleStories() {
</Box>

{data.map((results, i) => (
<TabPanelHelper value={value} index={i} key={`${results.sample[0].id}`}>
// eslint-disable-next-line react/no-array-index-key
<TabPanelHelper value={value} index={i} key={`$sample-story-${i}`}>
<SampleStoryShow
data={results.sample}
lSTP={lastSearchTimePlatform}
Expand Down
3 changes: 2 additions & 1 deletion mcweb/frontend/src/features/search/results/TopLanguages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export default function TopLanguages() {
</Box>

{prepareLanguageData(data).map((results, i) => (
<TabPanelHelper value={value} index={i} key={`${results.data[0].value}`}>
// eslint-disable-next-line react/no-array-index-key
<TabPanelHelper value={value} index={i} key={`top-language-${i}`}>
<BarChart
series={[results]}
normalized
Expand Down
3 changes: 2 additions & 1 deletion mcweb/frontend/src/features/search/results/TopSources.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export default function TopSources() {
</Box>

{prepareSourceData(data, normalized).map((results, i) => (
<TabPanelHelper value={value} index={i} key={`${results.data[0].value}`}>
// eslint-disable-next-line react/no-array-index-key
<TabPanelHelper value={value} index={i} key={`top-sources-${i}`}>
<BarChart
series={[results]}
normalized={normalized}
Expand Down
3 changes: 3 additions & 0 deletions mcweb/frontend/src/features/search/util/CSVDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ CSVDialog.propTypes = {
snackbarText: PropTypes.string,
variant: PropTypes.string,
userEmail: PropTypes.string,
// eslint-disable-next-line react/forbid-prop-types
data: PropTypes.arrayOf(PropTypes.object),
// eslint-disable-next-line react/forbid-prop-types
queryState: PropTypes.arrayOf(PropTypes.object),
};

Expand All @@ -160,4 +162,5 @@ CSVDialog.defaultProps = {
variant: 'text',
userEmail: '',
data: [{}],
queryState: [{}],
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function groupValues(elements, duration, normalized) {

export const prepareCountOverTimeData = (results, normalized, chartBy, queryState) => {
const series = [];
const colors = getColors(queryState)
const colors = getColors(queryState);
if (chartBy === DAY) {
results.forEach((result, i) => {
const preparedData = result.count_over_time.counts.map((r) => [
Expand Down

0 comments on commit 970edcb

Please sign in to comment.