Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook query preview exists even before the data source is selected #40608

Closed
nemanjaglumac opened this issue Mar 26, 2024 · 0 comments · Fixed by #40609
Closed

Notebook query preview exists even before the data source is selected #40608

nemanjaglumac opened this issue Mar 26, 2024 · 0 comments · Fixed by #40609
Assignees
Labels
Priority:P3 Cosmetic bugs, minor bugs with a clear workaround Querying/Notebook Items specific to the Custom/Notebook query builder .Team/QueryingComponents Type:Bug Product defects
Milestone

Comments

@nemanjaglumac
Copy link
Member

nemanjaglumac commented Mar 26, 2024

Describe the bug

We're showing the notebook query preview even before someone selects a data source. Clicking on it will result in a forever loading spinner and a failed POST /api/dataset request.

To Reproduce

  1. Click on "New" > Question
    new
  2. Click on the little preview button next to the blue "Pick your starting data" rectangle
  3. The loader is spinning ad infinitum and there is a failed request in the network tab
    Kapture 2024-03-26 at 08 50 21

Expected behavior

The preview button should appear only when a query can run, i.e. when there is a data source.

Logs

{
  "via": [
    {
      "type": "clojure.lang.ExceptionInfo",
      "message": "`database` is required for all queries whose type is not `internal`.",
      "data": {
        "status-code": 400,
        "query": {
          "type": "query",
          "query": {
            "limit": 10
          },
          "parameters": [],
          "middleware": {
            "js-int-to-string?": true,
            "userland-query?": true,
            "add-default-userland-constraints?": true
          },
          "info": null
        }
      },
      "at": [
        "metabase.api.dataset$fn__114124$_AMPERSAND_f__114127",
        "doInvoke",
        "dataset.clj",
        60
      ]
    }
  ],
  "trace": [
    [
      "metabase.api.dataset$fn__114124$_AMPERSAND_f__114127",
      "doInvoke",
      "dataset.clj",
      60
    ],
    [...],
    [
      "java.lang.Thread",
      "run",
      "Thread.java",
      829
    ]
  ],
  "cause": "`database` is required for all queries whose type is not `internal`.",
  "data": {
    "status-code": 400,
    "query": {
      "type": "query",
      "query": {
        "limit": 10
      },
      "parameters": [],
      "middleware": {
        "js-int-to-string?": true,
        "userland-query?": true,
        "add-default-userland-constraints?": true
      },
      "info": null
    }
  },
  "message": "`database` is required for all queries whose type is not `internal`.",
  "query": {
    "type": "query",
    "query": {
      "limit": 10
    },
    "parameters": [],
    "middleware": {
      "js-int-to-string?": true,
      "userland-query?": true,
      "add-default-userland-constraints?": true
    },
    "info": null
  }
}

Information about your Metabase installation

local dev, master, dc279fd, H2, Sample Database

Severity

P3

@nemanjaglumac nemanjaglumac added Type:Bug Product defects Priority:P3 Cosmetic bugs, minor bugs with a clear workaround Querying/Notebook Items specific to the Custom/Notebook query builder .Team/QueryingComponents labels Mar 26, 2024
@nemanjaglumac nemanjaglumac self-assigned this Mar 26, 2024
nemanjaglumac added a commit that referenced this issue Apr 2, 2024
nemanjaglumac added a commit that referenced this issue Apr 3, 2024
* Use MLv2 to determine whether a query can be previewed

* Add E2E repro for #40608

* Expand E2E repro

* Fix test

* Make sure the step is active and visible before offering to preview its query

* Expand E2E test

* Address review comment - use `getNotebookStep` helper
rafpaf pushed a commit that referenced this issue Apr 3, 2024
* Use MLv2 to determine whether a query can be previewed

* Add E2E repro for #40608

* Expand E2E repro

* Fix test

* Make sure the step is active and visible before offering to preview its query

* Expand E2E test

* Address review comment - use `getNotebookStep` helper
nemanjaglumac added a commit that referenced this issue Apr 11, 2024
* Use MLv2 to determine whether a query can be previewed

* Add E2E repro for #40608

* Expand E2E repro

* Fix test

* Make sure the step is active and visible before offering to preview its query

* Expand E2E test

* Address review comment - use `getNotebookStep` helper
nemanjaglumac added a commit that referenced this issue Apr 11, 2024
* Use MLv2 to determine whether a query can be previewed

* Add E2E repro for #40608

* Expand E2E repro

* Fix test

* Make sure the step is active and visible before offering to preview its query

* Expand E2E test

* Address review comment - use `getNotebookStep` helper

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
@nemanjaglumac nemanjaglumac added this to the 0.49.5 milestone Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:P3 Cosmetic bugs, minor bugs with a clear workaround Querying/Notebook Items specific to the Custom/Notebook query builder .Team/QueryingComponents Type:Bug Product defects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant