Files
cypress/packages/data-context/src/util/urqlCacheKeys.ts
T
Jennifer Shehane 10c6656ed6 misc: Remove migration UI, warnings, and errors for changes pre-Cypress 10 (v15) (#31629)
* begin removing migration code

* remove migration query

* add back actions

* remove more migration references

* more migration removals

* remove call to migration

* remove gqp-Migration file

* updates to remove migration

* update type

* remove a lot more migration code - especially errors

* Remove other errors/warnins for versions before 10.x

* update error snapshots

* fix some tests

* index on remove-migration: 49fa75ab78 Merge branch 'remove-migration' of https://github.com/cypress-io/cypress into remove-migration

* index on remove-migration: 49fa75ab78 Merge branch 'remove-migration' of https://github.com/cypress-io/cypress into remove-migration

* index on remove-migration: 49fa75ab78 Merge branch 'remove-migration' of https://github.com/cypress-io/cypress into remove-migration

* remove more system tests and references

* fix call to refreshMetaState which was lost at initialization

* rearrange some system tests to not be dependent on migration

* update welcome version test

* fix wording of messaging

* skip irrelevant test

* fix failing assertion

* remove tests around cypress-plugin-retries

* Remove test from config_spec

* Remove screenshot from snapshot

* fix tests + remove more migration projects

* remove + update system tests

* remove + update system tests

* remove some invalid dev-server: start errors

* remove references and tests around pluginsFile which was removed

* remove some more invalid config examples

* Add changelog entry

* fix changelog link

* fix unit test

* index on remove-migration: 490ddb134c Merge branch 'release/15.0.0' into remove-migration

* index on remove-migration: 490ddb134c Merge branch 'release/15.0.0' into remove-migration

* index on remove-migration: 490ddb134c Merge branch 'release/15.0.0' into remove-migration

* run all binary/windows tests on this branch

* Update packages/scaffold-config/test/unit/detect.spec.ts

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* Update packages/scaffold-config/test/unit/detect.spec.ts

Co-authored-by: Bill Glesias <bglesias@gmail.com>

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
2025-05-12 13:17:32 -04:00

52 lines
1.8 KiB
TypeScript

import type { CacheExchangeOpts } from '@urql/exchange-graphcache'
import { relayPagination } from '@urql/exchange-graphcache/extras'
import type { GraphCacheConfig } from '../gen/graphcache-config.gen'
/**
* Create a new type that overrides the keys, instead of using GraphCacheConfig
* directly; if we try to use it, creates a TS error on the cacheExchange
* related with "Types of property 'updates' are incompatible.""
*/
type UrqlCacheKeys = Omit<CacheExchangeOpts, 'keys'> & { keys: GraphCacheConfig['keys'] }
/**
* These are located in data-context, because we use them in the
* both the server-side and client-side urql, since we cache & hydrate
* the page on load
*
* We want to to keep the key definitions in sync between the
* server & client so we only define them once
*/
export const urqlCacheKeys: Partial<UrqlCacheKeys> = {
keys: {
DevState: (data) => data.__typename,
Wizard: (data) => data.__typename,
CloudRunCommitInfo: () => null,
GitInfo: () => null,
CodeFrame: () => null,
ProjectPreferences: (data) => data.__typename,
VersionData: () => null,
ScaffoldedFile: () => null,
SpecDataAggregate: () => null,
LocalSettings: (data) => data.__typename,
LocalSettingsPreferences: () => null,
AuthState: () => null,
CloudProjectNotFound: (data) => data.__typename,
CloudProjectSpecNotFound: (data) => null,
CloudProjectUnauthorized: (data) => data.__typename,
CloudLatestRunUpdateSpecData: (data) => null,
CloudProjectSpecFlakyStatus: (data) => null,
CloudPollingIntervals: (data) => null,
GeneratedSpecError: () => null,
GenerateSpecResponse: (data) => data.__typename,
CloudFeatureNotEnabled: () => null,
UsageLimitExceeded: () => null,
},
resolvers: {
CloudProject: {
runs: relayPagination({ mergeMode: 'outwards' }),
},
},
}