Skip to content

Commit

Permalink
Fix persisting datasource selection choice (#6181)
Browse files Browse the repository at this point in the history
* Fix persisting datasource selection choice

Closes #5646.

We were already storing this in localStorage, however we weren't
accounting for the fact that it was stored as a string, rather than
an integer.

* Restyled by prettier (#6182)

Co-authored-by: Restyled.io <commits@restyled.io>

---------

Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
3 people authored Jul 15, 2023
1 parent 05526b5 commit d5b821e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions client/app/pages/queries/QuerySource.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ function QuerySource(props) {
// choose data source id for new queries
if (dataSourcesLoaded && queryFlags.isNew) {
const firstDataSourceId = dataSources.length > 0 ? dataSources[0].id : null;
const selectedDataSourceId = parseInt(localStorage.getItem("lastSelectedDataSourceId")) || null;

handleDataSourceChange(
chooseDataSourceId(
[query.data_source_id, localStorage.getItem("lastSelectedDataSourceId"), firstDataSourceId],
dataSources
)
chooseDataSourceId([query.data_source_id, selectedDataSourceId, firstDataSourceId], dataSources)
);
}
}, [query.data_source_id, queryFlags.isNew, dataSourcesLoaded, dataSources, handleDataSourceChange]);
Expand Down

0 comments on commit d5b821e

Please sign in to comment.