@databrainhq/plugin 0.7.11 → 0.7.12

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/dist/index.es.js CHANGED
@@ -7886,7 +7886,7 @@ var styles$y = {
7886
7886
  };
7887
7887
  const fetcher = (query, variables, options2) => {
7888
7888
  return async () => {
7889
- const res = await fetch("https://backend.usedatabrain.com/v1/graphql", {
7889
+ const res = await fetch("http://127.0.0.1:8082/v1/graphql", {
7890
7890
  method: "POST",
7891
7891
  headers: {
7892
7892
  "Content-Type": "application/json",
@@ -90056,19 +90056,23 @@ const MetricForm = ({
90056
90056
  });
90057
90057
  useEffect(() => {
90058
90058
  if (columnList.length) {
90059
- setSelectedDimensions([]);
90060
- setMetrics([]);
90059
+ setSelectedDimensions((prev) => prev.filter((c2) => columnList.map((col) => col.value).includes(c2)));
90060
+ setMetrics((prev) => prev.filter((c2) => {
90061
+ var _a2;
90062
+ return columnList.map((col) => col.value).includes(((_a2 = c2.as.match(/\((.*?)\)/)) == null ? void 0 : _a2[1]) || "");
90063
+ }));
90061
90064
  setMetricColumn(columnList[0]);
90062
- setColumns([]);
90065
+ setColumns((prev) => prev.filter((c2) => columnList.map((col) => col.value).includes(c2.value)));
90063
90066
  setColumn(columnList[0]);
90064
90067
  setFilterColumn(columnList[0]);
90065
- setSort("");
90068
+ setSort((prev) => columnList.find((c2) => prev.includes(c2.value)) ? prev : "");
90066
90069
  setSortColumn(columnList[0]);
90067
- setFilters([]);
90070
+ setFilters((prev) => prev.filter((c2) => columnList.find((col) => c2.includes(col.value))));
90068
90071
  setIncludeTime(false);
90069
- setSortDescending(false);
90070
- setTimeGrainValue("");
90071
- setTimeGrain("");
90072
+ setTimeGrain((prev) => columnList.find((c2) => prev.includes(c2.value)) ? prev : "");
90073
+ if (!timeGrain) {
90074
+ setTimeGrainValue("");
90075
+ }
90072
90076
  }
90073
90077
  }, [columnList]);
90074
90078
  useEffect(() => {