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

refactor: remove concept of liveMutation #19528

Merged
merged 5 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/app/src/composables/usePreferences.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { useRunnerUiStore, RunnerUiState } from '../store'
import { useMutation, gql } from '@urql/vue'
import { Preferences_SetPreferencesDocument } from '@packages/data-context/src/gen/all-operations.gen'
import { Preferences_SetPreferencesDocument } from '@packages/app/src/generated/graphql'

const runnerUiStore = useRunnerUiStore()

gql`
mutation Preferences_SetPreferences ($value: String!) {
setPreferences (value: $value)
setPreferences (value: $value) {
...TestingPreferences
...SpecRunner_Preferences
}
}`

export function usePreferences () {
Expand Down
20 changes: 13 additions & 7 deletions packages/app/src/runner/SpecRunner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,7 @@ import { runnerConstants } from './runner-constants'
const { height: windowHeight, width: windowWidth } = useWindowSize()

gql`
fragment SpecRunner on Query {
...Specs_InlineSpecList
currentProject {
id
...SpecRunnerHeader
}
...ChooseExternalEditor
fragment SpecRunner_Preferences on Query {
localSettings {
preferences {
isSpecsListOpen
Expand All @@ -125,6 +119,18 @@ fragment SpecRunner on Query {
}
`

gql`
fragment SpecRunner on Query {
...Specs_InlineSpecList
currentProject {
id
...SpecRunnerHeader
}
...ChooseExternalEditor
...SpecRunner_Preferences
}
`

gql`
mutation OpenFileInIDE ($input: FileDetailsInput!) {
openFileInIDE (input: $input)
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/runner/SpecRunnerHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ mutation SpecRunnerHeader_SetBrowser($browserId: ID!, $specPath: String!) {
isSelected
}
}
launchOpenProject(specPath: $specPath)
launchOpenProject(specPath: $specPath) {
id
}
}
`

Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/settings/device/ExternalEditorSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import { useMutation } from '@urql/vue'

gql`
mutation ExternalEditorSettings_SetPreferredEditorBinary ($value: String!) {
setPreferences (value: $value)
setPreferences (value: $value) {
...ExternalEditorSettings
}
}`

const { t } = useI18n()
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/settings/device/TestingPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ fragment TestingPreferences on Query {

gql`
mutation SetTestingPreferences($value: String!) {
setPreferences (value: $value)
setPreferences (value: $value) {
...TestingPreferences
}
}`

const setPreferences = useMutation(SetTestingPreferencesDocument)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export const stubMutation: MaybeResolver<Mutation> = {
addProject (source, args, ctx) {
ctx.projects.push(createTestGlobalProject(path.basename(args.path)))

return true
return {}
},
setCurrentProject (source, args, ctx) {
const project = ctx.projects.find((p) => p.projectRoot === args.path)

ctx.currentProject = project ? createTestCurrentProject(project.title) : null

return true
return {}
},
clearCurrentProject (source, args, ctx) {
ctx.currentProject = null
Expand All @@ -26,7 +26,7 @@ export const stubMutation: MaybeResolver<Mutation> = {
removeProject (source, args, ctx) {
ctx.projects = ctx.projects.filter((p) => p.projectRoot !== args.path)

return true
return {}
},
hideBrowserWindow (source, args, ctx) {
return true
Expand Down
8 changes: 6 additions & 2 deletions packages/frontend-shared/src/gql-components/Auth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ fragment Auth on Query {

gql`
mutation Logout {
logout
logout {
...Auth
}
}
`

gql`
mutation Login {
login
login {
...Auth
}
}
`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ fragment ChooseExternalEditorModal on Query {

gql`
mutation ChooseExternalEditorModal_SetPreferredEditorBinary ($value: String!) {
setPreferences (value: $value)
setPreferences (value: $value) {
localSettings {
preferences {
preferredEditorBinary
}
}
}
}`

const setPreferredBinaryEditor = useMutation(ChooseExternalEditorModal_SetPreferredEditorBinaryDocument)
Expand Down
6 changes: 4 additions & 2 deletions packages/frontend-shared/src/gql-components/topnav/TopNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ fragment TopNav on Query {
`

gql`
mutation TopNav_LaunchOpenProject {
launchOpenProject
mutation TopNav_LaunchOpenProject {
launchOpenProject {
id
}
}
`

Expand Down
22 changes: 8 additions & 14 deletions packages/graphql/schemas/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,7 @@ type Mutation {
"""Whether to open the project when added"""
open: Boolean
path: String!
): Boolean

"""Create an Index HTML file for a new component testing project"""
appCreateComponentIndexHtml(template: String!): Boolean
): Query

"""Clears the currently active project"""
clearCurrentProject: Query
Expand Down Expand Up @@ -641,7 +638,7 @@ type Mutation {
internal_clearProjectPreferencesCache(projectTitle: String!): Boolean

"""Launches project from open_project global singleton"""
launchOpenProject(specPath: String): Boolean
launchOpenProject(specPath: String): CurrentProject

"""Sets the active browser"""
launchpadSetBrowser(
Expand All @@ -650,10 +647,10 @@ type Mutation {
): CurrentProject

"""Auth with Cypress Cloud"""
login: Boolean
login: Query

"""Log out of Cypress Cloud"""
logout: Boolean
logout: Query

"""Open a path in preferred IDE"""
openDirectoryInIDE(path: String!): Boolean
Expand All @@ -669,30 +666,27 @@ type Mutation {
reconfigureProject: Boolean!

"""Remove project from projects array and cache"""
removeProject(path: String!): Boolean
removeProject(path: String!): Query

"""Reset the Wizard to the starting position"""
resetWizard: Boolean!
scaffoldIntegration: [CodeGenResultWithFileParts!]!
scaffoldTestingType: Query

"""Set active project to run tests on"""
setCurrentProject(path: String!): Boolean
setCurrentProject(path: String!): Query
setCurrentTestingType(testingType: TestingTypeEnum!): Query

"""
Update local preferences (also known as appData). The payload, `value`, should be a `JSON.stringified()` object of the new values you'd like to persist. Example: `setPreferences (value: JSON.stringify({ lastOpened: Date.now() }))`
"""
setPreferences(value: String!): Boolean
setPreferences(value: String!): Query

"""Save the projects preferences to cache"""
setProjectPreferences(browserPath: String!, testingType: TestingTypeEnum!): Query!

"""show the launchpad at the browser picker step"""
showElectronOnAppExit: Boolean

"""Updates the different fields of the wizard data store"""
wizardUpdate(input: WizardUpdateInput!): Boolean
wizardUpdate(input: WizardUpdateInput!): Wizard
}

"""Implements the Relay Node spec"""
Expand Down
1 change: 0 additions & 1 deletion packages/graphql/src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable padding-line-between-statements */
// created by autobarrel, do not modify directly

export * from './nexusLiveMutation'
export * from './nexusNodePlugin'
75 changes: 0 additions & 75 deletions packages/graphql/src/plugins/nexusLiveMutation.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/graphql/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { makeSchema, connectionPlugin } from 'nexus'
import * as schemaTypes from './schemaTypes/'
import { nodePlugin } from './plugins/nexusNodePlugin'
import { remoteSchemaWrapped } from './stitching/remoteSchemaWrapped'
import { NexusLiveMutationPlugin } from './plugins/nexusLiveMutation'

const isCodegen = Boolean(process.env.CYPRESS_INTERNAL_NEXUS_CODEGEN)

Expand Down Expand Up @@ -36,7 +35,6 @@ export const graphqlSchema = makeSchema({
},
}),
nodePlugin,
NexusLiveMutationPlugin,
],
formatTypegen (content, type) {
if (type === 'schema') {
Expand Down
Loading