Repository: cypress-io/cypress
File: packages/app/src/store/studio-store.ts (TypeScript)

Code before:
      } else if (this.suiteId) {
        this.setActive(true)
      }
    },

    initialize () {
      if (this.newTestLineNumber) {
        getCypress().runner.setNewTestLineNumber(this.newTestLineNumber)
        // Creating a new test - need to bypass .only filtering
        getCypress().runner.setIsStudioCreatedTest(true)
        this._wasStudioCreatedTest = true
      } else if (this.suiteId) {
        getCypress().runner.setOnlySuiteId(this.suiteId)
        // Creating a new test in a suite - need to bypass .only filtering
        getCypress().runner.setIsStudioCreatedTest(true)
        this._wasStudioCreatedTest = true
      } else if (this.testId) {
        if (this._wasStudioCreatedTest) {
          // This test was created by studio, so we need to set the test id
          getCypress().runner.setOnlyTestId(this.testId)
          getCypress().runner.setIsStudioCreatedTest(true)
        } else {
          // this is an existing test - respect .only filtering
          getCypress().runner.setOnlyTestId(this.testId)
          getCypress().runner.setIsStudioCreatedTest(false)
        }
      }
    },

    interceptTest (test) {
      // if this test is the one we created, we can just set the test id
      if (this.newTestLineNumber && test.invocationDetails?.line === this.newTestLineNumber) {
        this.setTestId(test.id)
        getCypress().runner.setIsStudioCreatedTest(true)
      } else if (this.suiteId) {
        this.setTestId(test.id)
        getCypress().runner.setIsStudioCreatedTest(true)
      }

      if (this.testId) {
        if (test.invocationDetails) {
          this.setFileDetails(test.invocationDetails)
        }

        this.setRunnableTitle(test.title)
      }
    },

    start () {
      this.isActive = true
      this.isLoading = false

Review comment (suggestion):
This is a bit confusing to read. Perhaps have some logic pulled out:

```js
get shouldBypassOnlyFiltering() {
  return this.newTestLineNumber || this._isStudioCreatedTest
}
```



Code after:
      } else if (this.suiteId) {
        this.setActive(true)
      }
    },

    initialize () {
      if (this.newTestLineNumber) {
        getCypress().runner.setNewTestLineNumber(this.newTestLineNumber)
        // Creating a new test - need to bypass .only filtering
        getCypress().runner.setIsStudioCreatedTest(true)
        this._isStudioCreatedTest = true
      } else if (this.testId) {
        getCypress().runner.setOnlyTestId(this.testId)
        getCypress().runner.setIsStudioCreatedTest(this._isStudioCreatedTest)
      }
    },

    interceptTest (test) {
      // if this test is the one we created, we can just set the test id
      if ((this.newTestLineNumber && test.invocationDetails?.line === this.newTestLineNumber) || this.suiteId) {
        this._isStudioCreatedTest = true
        this.setTestId(test.id)
        getCypress().runner.setIsStudioCreatedTest(true)
      }

      if (this.testId) {
        if (test.invocationDetails) {
          this.setFileDetails(test.invocationDetails)
        }

        this.setRunnableTitle(test.title)
      }
    },

    start () {
      this.isActive = true
      this.isLoading = false
      this.logs = []
      this._currentId = 1
      this._hasStarted = true

      const autStore = useAutStore()

      if (this._initialUrl || this.url) {
        this.visitUrl(this._initialUrl)
      }

      if (!this.url && autStore.url) {
        this.setUrl(autStore.url)
      }
    },