Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Put GraphCache errors documentation on website (#817)

* Fix typos in 'docs/graphcache/schema-awareness.md'.

* Move Graphcache's 'help.md' so it gets published on formidable.com.

authored by

Amy Boyd and committed by
GitHub
5295e33e b53a7251

+290 -279
+2
docs/graphcache/README.md
··· 47 47 - 📡 **Offline support** (work in progress) _Graphcache_ can persist and rehydrate its entire state, 48 48 allowing an offline application to be built that is able to execute queries against the cache 49 49 although the device is offline. 50 + - 🐛 [**Errors and warnings**](./errors.md). All potential errors are documented with information on 51 + how you may be able to fix them. 50 52 51 53 ## Installation and Setup 52 54
+274
docs/graphcache/errors.md
··· 1 + # Help! 2 + 3 + **This document lists out all errors and warnings in `@urql/exchange-graphcache`.** 4 + 5 + Any unexpected behaviour, condition, or error will be marked by an error or warning 6 + in development, which will output a helpful little message. Sometimes however, this 7 + message may not actually tell you everything about what's going on. 8 + 9 + This is a supporting document that explains every error and attempts to give more 10 + information on how you may be able to fix some issues or avoid these errors/warnings. 11 + 12 + ## (1) Invalid GraphQL document <a id="1"></a> 13 + 14 + > Invalid GraphQL document: All GraphQL documents must contain an OperationDefinition 15 + > node for a query, subscription, or mutation. 16 + 17 + There are multiple places where you're passing in GraphQL documents, either through 18 + methods on `Cache` (e.g. `cache.updateQuery`) or via `urql` using the `Client` or 19 + hooks like `useQuery`. 20 + 21 + Your queries must always contain a main operation, so either a query, mutation, or 22 + subscription. This error occurs when this is missing, because the `DocumentNode` 23 + is maybe empty or only contains fragments. 24 + 25 + ## (2) Invalid Cache call <a id="2"></a> 26 + 27 + > Invalid Cache call: The cache may only be accessed or mutated during 28 + > operations like write or query, or as part of its resolvers, updaters, 29 + > or optimistic configs. 30 + 31 + If you're somehow accessing the `Cache` (an instance of `Store`) outside of any 32 + of the usual operations then this error will be thrown. 33 + 34 + Please make sure that you're only calling methods on the `cache` as part of 35 + configs that you pass to your `cacheExchange`. Outside of these functions the cache 36 + must not be changed. 37 + 38 + However when you're not using the `cacheExchange` and are trying to use the 39 + `Store` on its own, then you may run into issues where its global state wasn't 40 + initialised correctly. 41 + 42 + This is a safe-guard to prevent any asynchronous work to take place, or to 43 + avoid mutating the cache outside of any normal operation. 44 + 45 + ## (3) Invalid Object type <a id="3"></a> 46 + 47 + > Invalid Object type: The type `???` is not an object in the defined schema, 48 + > but the GraphQL document is traversing it. 49 + 50 + When you're passing an introspected schema to the cache exchange, it is 51 + able to check whether all your queries are valid. 52 + This error occurs when an unknown type is found as part of a query or 53 + fragment. 54 + 55 + Check whether your schema is up-to-date or whether you're using an invalid 56 + typename somewhere, maybe due to a typo. 57 + 58 + ## (4) Invalid field <a id="4"></a> 59 + 60 + > Invalid field: The field `???` does not exist on `???`, 61 + > but the GraphQL document expects it to exist.<br /> 62 + > Traversal will continue, however this may lead to undefined behavior! 63 + 64 + Similarly to the previous warning, when you're passing an introspected 65 + schema to the cache exchange, it is able to check whether all your queries are valid. 66 + This warning occurs when an unknown field is found on a selection set as part 67 + of a query or fragment. 68 + 69 + Check whether your schema is up-to-date or whether you're using an invalid 70 + field somewhere, maybe due to a typo. 71 + 72 + As the warning states, this won't lead any operation to abort or an error 73 + to be thrown! 74 + 75 + ## (5) Invalid Abstract type <a id="5"></a> 76 + 77 + > Invalid Abstract type: The type `???` is not an Interface or Union type 78 + > in the defined schema, but a fragment in the GraphQL document is using it 79 + > as a type condition. 80 + 81 + When you're passing an introspected schema to the cache exchange, it becomes 82 + able to deterministically check whether an entity in the cache matches a fragment's 83 + type condition. 84 + 85 + This applies to full fragments (`fragment _ on Interface`) or inline fragments 86 + (`... on Interface`), that apply to interfaces instead of to a concrete object typename. 87 + 88 + Check whether your schema is up-to-date or whether you're using an invalid 89 + field somewhere, maybe due to a typo. 90 + 91 + ## (6) readFragment(...) was called with an empty fragment <a id="6"></a> 92 + 93 + > readFragment(...) was called with an empty fragment. 94 + > You have to call it with at least one fragment in your GraphQL document. 95 + 96 + You probably have called `cache.readFragment` with a GraphQL 97 + document that doesn't contain a main fragment. 98 + 99 + This error occurs when no main fragment can be found, because the `DocumentNode` 100 + is maybe empty or does not contain fragments. 101 + 102 + When you're calling a fragment method, please ensure that you're only passing fragments 103 + in your GraphQL document. The first fragment will be used to start writing data. 104 + 105 + ## (7) Can't generate a key for readFragment(...) <a id="7"></a> 106 + 107 + > Can't generate a key for readFragment(...). 108 + > You have to pass an `id` or `_id` field or create a custom `keys` config for `???`. 109 + 110 + You probably have called `cache.readFragment` with data that the cache can't generate a 111 + key for. 112 + 113 + This may either happen because you're missing the `id` or `_id` field or some other 114 + fields for your custom `keys` config. 115 + 116 + Please make sure that you include enough properties on your data so that `readFragment` 117 + can generate a key. 118 + 119 + ## (8) Invalid resolver data <a id="8"></a> 120 + 121 + > Invalid resolver value: The resolver at `???` returned an invalid typename that 122 + > could not be reconciled with the cache. 123 + 124 + This error may occur when you provide a cache resolver for a field using `resolvers` config. 125 + 126 + The value that you returns needs to contain a `__typename` field and this field must 127 + match the `__typename` field that exists in the cache, if any. This is because it's not 128 + possible to return a different type for a single field. 129 + 130 + Please check your schema for the type that your resolver has to return, then add a 131 + `__typename` field to your returned resolver value that matches this type. 132 + 133 + ## (9) Invalid resolver value <a id="9"></a> 134 + 135 + > Invalid resolver value: The field at `???` is a scalar (number, boolean, etc), 136 + > but the GraphQL query expects a selection set for this field. 137 + 138 + The GraphQL query that has been walked contains a selection set at the place where 139 + your resolver is located. 140 + 141 + This means that a full entity object needs to be returned, but instead the cache 142 + received a number, boolean, or another scalar from your resolver. 143 + 144 + Please check that your resolvers return scalars where there's no selection set, 145 + and entities where there is one. 146 + 147 + ## (10) writeOptimistic(...) was called with an operation that isn't a mutation <a id="10"></a> 148 + 149 + > writeOptimistic(...) was called with an operation that is not a mutation. 150 + > This case is unsupported and should never occur. 151 + 152 + This should never happen, please open an issue if it does. This occurs when `writeOptimistic` 153 + attempts to write an optimistic result for a query or subscription, instead of a mutation. 154 + 155 + ## (11) writeFragment(...) was called with an empty fragment <a id="11"></a> 156 + 157 + > writeFragment(...) was called with an empty fragment. 158 + > You have to call it with at least one fragment in your GraphQL document. 159 + 160 + You probably have called `cache.writeFragment` with a GraphQL 161 + document that doesn't contain a main fragment. 162 + 163 + This error occurs when no main fragment can be found, because the `DocumentNode` 164 + is maybe empty or does not contain fragments. 165 + 166 + When you're calling a fragment method, please ensure that you're only passing fragments 167 + in your GraphQL document. The first fragment will be used to start writing data. 168 + 169 + ## (12) Can't generate a key for writeFragment(...) <a id="12"></a> 170 + 171 + > Can't generate a key for writeFragment(...) data. 172 + > You have to pass an `id` or `_id` field or create a custom `keys` config for `???`. 173 + 174 + You probably have called `cache.writeFragment` with data that the cache can't generate a 175 + key for. 176 + 177 + This may either happen because you're missing the `id` or `_id` field or some other 178 + fields for your custom `keys` config. 179 + 180 + Please make sure that you include enough properties on your data so that `writeFragment` 181 + can generate a key. 182 + 183 + ## (13) Invalid undefined <a id="13"></a> 184 + 185 + > Invalid undefined: The field at `???` is `undefined`, but the GraphQL query expects a 186 + > scalar (number, boolean, etc) / selection set for this field. 187 + 188 + As data is written to the cache, this warning is issued when `undefined` is encountered. 189 + GraphQL results should never contain an `undefined` value, so this warning will let you 190 + know which part of your result did contain `undefined`. 191 + 192 + ## (15) Invalid key <a id="15"></a> 193 + 194 + > Invalid key: The GraphQL query at the field at `???` has a selection set, 195 + > but no key could be generated for the data at this field. 196 + > You have to request `id` or `_id` fields for all selection sets or create a 197 + > custom `keys` config for `???`. 198 + > Entities without keys will be embedded directly on the parent entity. 199 + > If this is intentional, create a `keys` config for `???` that always returns null. 200 + 201 + This error occurs when the cache can't generate a key for an entity. The key 202 + would then effectively be `null` and the entity won't be cached by a key. 203 + 204 + Conceptually this means that an entity won't be normalised but will indeed 205 + be cached by the parent's key and field, which is displayed in the first 206 + part of the warning. 207 + 208 + This may mean that you forgot to include an `id` or `_id` field. 209 + 210 + But if your entity at that place doesn't have any `id` fields, then you may 211 + have to create a custom `keys` config. This `keys` function either needs to 212 + return a unique ID for your entity or it needs to explicitly return `null` to silence 213 + this warning. 214 + 215 + ## (16) Heuristic Fragment Matching <a id="16"></a> 216 + 217 + > Heuristic Fragment Matching: A fragment is trying to match against the `???` type, 218 + > but the type condition is `???`. Since GraphQL allows for interfaces `???` may be 219 + > an interface. 220 + > A schema needs to be defined for this match to be deterministic, otherwise 221 + > the fragment will be matched heuristically! 222 + 223 + This warning is issued on fragment matching. Fragment matching is the process 224 + of matching a fragment against a piece of data in the cache and that data's `__typename` 225 + field. 226 + 227 + When the `__typename` field doesn't match the fragment's type, then we may be 228 + dealing with an interface and/or enum. In such a case the fragment may _still match_ 229 + if it's referring to an interface (`... on Interface`). Graphcache is supposed to be 230 + usable without much config, so what it does in this case is apply a heuristic match. 231 + 232 + In a heuristic fragment match we check whether all fields on the fragment are present 233 + in the cache, which is then treated as a fragment match. 234 + 235 + When you pass an introspected schema to the cache, this warning will never be displayed 236 + as the cache can then do deterministic fragment matching using schema information. 237 + 238 + ## (17) Invalid type <a id="17"></a> 239 + 240 + > Invalid type: The type `???` is used with @populate but does not exist. 241 + 242 + When you're using the populate exchange with an introspected schema and add the 243 + `@populate` directive to fields it first checks whether the type is valid and 244 + exists on the schema. 245 + 246 + If the field does not have sufficient type information because it doesn't exist 247 + on the schema or does not match expectations then this warning is logged. 248 + 249 + Check whether your schema is up-to-date or whether you're using an invalid 250 + field somewhere, maybe due to a typo. 251 + 252 + ## (18) Invalid TypeInfo state <a id="18"></a> 253 + 254 + > Invalid TypeInfo state: Found no flat schema type when one was expected. 255 + 256 + When you're using the populate exchange with an introspected schema, it will 257 + start collecting used fragments and selection sets on all of your queries. 258 + This error may occur if it hits unexpected types or inexistent types when doing so. 259 + 260 + Check whether your schema is up-to-date or whether you're using an invalid 261 + field somewhere, maybe due to a typo. 262 + 263 + Please open an issue if it happens on a query that you expect to be supported 264 + by the `populateExchange`. 265 + 266 + ## (19) Can't generate a key for invalidate(...) 267 + 268 + > Can't generate a key for invalidate(...). 269 + > You need to pass in a valid key (**typename:id) or an object with the "**typename" property and an "id" or "\_id" property. 270 + 271 + You probably have called `cache.invalidate` with data that the cache can't generate a key for. 272 + 273 + This may either happen because you're missing the `__typename` and `id` or `_id` field or if the last two 274 + aren't applicable to this entity a custom `keys` entry.
+2 -2
docs/graphcache/schema-awareness.md
··· 6 6 # Schema Awareness 7 7 8 8 As mentioned in the docs we allow for the schema to be passed 9 - to the `cacheExchange` this allows for partial results and deterministic 9 + to the `cacheExchange`. This allows for partial results and deterministic 10 10 fragment matching. 11 11 With deterministic fragment matching we mean that if you use an interface 12 - or a union we will be 100% sure you're allowed to do so, we'll check if the 12 + or a union we will be 100% sure you're allowed to do so, therefore we'll check if the 13 13 type you request can actually be returned from this union/interface. 14 14 15 15 ## Getting your schema
+6 -273
exchanges/graphcache/help.md
··· 1 - # Help! 2 - 3 - **This document lists out all errors and warnings in `@urql/exchange-graphcache`.** 4 - 5 - Any unexpected behaviour, condition, or error will be marked by an error or warning 6 - in development, which will output a helpful little message. Sometimes however, this 7 - message may not actually tell you everything about what's going on. 8 - 9 - This is a supporting document that explains every error and attempts to give more 10 - information on how you may be able to fix some issues or avoid these errors/warnings. 11 - 12 - ## (1) Invalid GraphQL document <a id="1"></a> 13 - 14 - > Invalid GraphQL document: All GraphQL documents must contain an OperationDefinition 15 - > node for a query, subscription, or mutation. 16 - 17 - There are multiple places where you're passing in GraphQL documents, either through 18 - methods on `Cache` (e.g. `cache.updateQuery`) or via `urql` using the `Client` or 19 - hooks like `useQuery`. 20 - 21 - Your queries must always contain a main operation, so either a query, mutation, or 22 - subscription. This error occurs when this is missing, because the `DocumentNode` 23 - is maybe empty or only contains fragments. 24 - 25 - ## (2) Invalid Cache call <a id="2"></a> 26 - 27 - > Invalid Cache call: The cache may only be accessed or mutated during 28 - > operations like write or query, or as part of its resolvers, updaters, 29 - > or optimistic configs. 30 - 31 - If you're somehow accessing the `Cache` (an instance of `Store`) outside of any 32 - of the usual operations then this error will be thrown. 33 - 34 - Please make sure that you're only calling methods on the `cache` as part of 35 - configs that you pass to your `cacheExchange`. Outside of these functions the cache 36 - must not be changed. 37 - 38 - However when you're not using the `cacheExchange` and are trying to use the 39 - `Store` on its own, then you may run into issues where its global state wasn't 40 - initialised correctly. 41 - 42 - This is a safe-guard to prevent any asynchronous work to take place, or to 43 - avoid mutating the cache outside of any normal operation. 44 - 45 - ## (3) Invalid Object type <a id="3"></a> 46 - 47 - > Invalid Object type: The type `???` is not an object in the defined schema, 48 - > but the GraphQL document is traversing it. 49 - 50 - When you're passing an introspected schema to the cache exchange, it is 51 - able to check whether all your queries are valid. 52 - This error occurs when an unknown type is found as part of a query or 53 - fragment. 54 - 55 - Check whether your schema is up-to-date or whether you're using an invalid 56 - typename somewhere, maybe due to a typo. 57 - 58 - ## (4) Invalid field <a id="4"></a> 59 - 60 - > Invalid field: The field `???` does not exist on `???`, 61 - > but the GraphQL document expects it to exist.<br /> 62 - > Traversal will continue, however this may lead to undefined behavior! 63 - 64 - Similarly to the previous warning, when you're passing an introspected 65 - schema to the cache exchange, it is able to check whether all your queries are valid. 66 - This warning occurs when an unknown field is found on a selection set as part 67 - of a query or fragment. 68 - 69 - Check whether your schema is up-to-date or whether you're using an invalid 70 - field somewhere, maybe due to a typo. 71 - 72 - As the warning states, this won't lead any operation to abort or an error 73 - to be thrown! 74 - 75 - ## (5) Invalid Abstract type <a id="5"></a> 76 - 77 - > Invalid Abstract type: The type `???` is not an Interface or Union type 78 - > in the defined schema, but a fragment in the GraphQL document is using it 79 - > as a type condition. 80 - 81 - When you're passing an introspected schema to the cache exchange, it becomes 82 - able to deterministically check whether an entity in the cache matches a fragment's 83 - type condition. 84 - 85 - This applies to full fragments (`fragment _ on Interface`) or inline fragments 86 - (`... on Interface`), that apply to interfaces instead of to a concrete object typename. 87 - 88 - Check whether your schema is up-to-date or whether you're using an invalid 89 - field somewhere, maybe due to a typo. 90 - 91 - ## (6) readFragment(...) was called with an empty fragment <a id="6"></a> 92 - 93 - > readFragment(...) was called with an empty fragment. 94 - > You have to call it with at least one fragment in your GraphQL document. 95 - 96 - You probably have called `cache.readFragment` with a GraphQL 97 - document that doesn't contain a main fragment. 98 - 99 - This error occurs when no main fragment can be found, because the `DocumentNode` 100 - is maybe empty or does not contain fragments. 101 - 102 - When you're calling a fragment method, please ensure that you're only passing fragments 103 - in your GraphQL document. The first fragment will be used to start writing data. 104 - 105 - ## (7) Can't generate a key for readFragment(...) <a id="7"></a> 106 - 107 - > Can't generate a key for readFragment(...). 108 - > You have to pass an `id` or `_id` field or create a custom `keys` config for `???`. 109 - 110 - You probably have called `cache.readFragment` with data that the cache can't generate a 111 - key for. 112 - 113 - This may either happen because you're missing the `id` or `_id` field or some other 114 - fields for your custom `keys` config. 1 + This file (`exchanges/graphcache/help.md`) has been moved to `docs/graphcache/errors.md` 115 2 116 - Please make sure that you include enough properties on your data so that `readFragment` 117 - can generate a key. 118 - 119 - ## (8) Invalid resolver data <a id="8"></a> 120 - 121 - > Invalid resolver value: The resolver at `???` returned an invalid typename that 122 - > could not be reconciled with the cache. 123 - 124 - This error may occur when you provide a cache resolver for a field using `resolvers` config. 125 - 126 - The value that you returns needs to contain a `__typename` field and this field must 127 - match the `__typename` field that exists in the cache, if any. This is because it's not 128 - possible to return a different type for a single field. 129 - 130 - Please check your schema for the type that your resolver has to return, then add a 131 - `__typename` field to your returned resolver value that matches this type. 132 - 133 - ## (9) Invalid resolver value <a id="9"></a> 134 - 135 - > Invalid resolver value: The field at `???` is a scalar (number, boolean, etc), 136 - > but the GraphQL query expects a selection set for this field. 137 - 138 - The GraphQL query that has been walked contains a selection set at the place where 139 - your resolver is located. 140 - 141 - This means that a full entity object needs to be returned, but instead the cache 142 - received a number, boolean, or another scalar from your resolver. 143 - 144 - Please check that your resolvers return scalars where there's no selection set, 145 - and entities where there is one. 146 - 147 - ## (10) writeOptimistic(...) was called with an operation that isn't a mutation <a id="10"></a> 148 - 149 - > writeOptimistic(...) was called with an operation that is not a mutation. 150 - > This case is unsupported and should never occur. 151 - 152 - This should never happen, please open an issue if it does. This occurs when `writeOptimistic` 153 - attempts to write an optimistic result for a query or subscription, instead of a mutation. 154 - 155 - ## (11) writeFragment(...) was called with an empty fragment <a id="11"></a> 156 - 157 - > writeFragment(...) was called with an empty fragment. 158 - > You have to call it with at least one fragment in your GraphQL document. 159 - 160 - You probably have called `cache.writeFragment` with a GraphQL 161 - document that doesn't contain a main fragment. 162 - 163 - This error occurs when no main fragment can be found, because the `DocumentNode` 164 - is maybe empty or does not contain fragments. 165 - 166 - When you're calling a fragment method, please ensure that you're only passing fragments 167 - in your GraphQL document. The first fragment will be used to start writing data. 168 - 169 - ## (12) Can't generate a key for writeFragment(...) <a id="12"></a> 170 - 171 - > Can't generate a key for writeFragment(...) data. 172 - > You have to pass an `id` or `_id` field or create a custom `keys` config for `???`. 173 - 174 - You probably have called `cache.writeFragment` with data that the cache can't generate a 175 - key for. 176 - 177 - This may either happen because you're missing the `id` or `_id` field or some other 178 - fields for your custom `keys` config. 179 - 180 - Please make sure that you include enough properties on your data so that `writeFragment` 181 - can generate a key. 182 - 183 - ## (13) Invalid undefined <a id="13"></a> 184 - 185 - > Invalid undefined: The field at `???` is `undefined`, but the GraphQL query expects a 186 - > scalar (number, boolean, etc) / selection set for this field. 187 - 188 - As data is written to the cache, this warning is issued when `undefined` is encountered. 189 - GraphQL results should never contain an `undefined` value, so this warning will let you 190 - know which part of your result did contain `undefined`. 191 - 192 - ## (15) Invalid key <a id="15"></a> 193 - 194 - > Invalid key: The GraphQL query at the field at `???` has a selection set, 195 - > but no key could be generated for the data at this field. 196 - > You have to request `id` or `_id` fields for all selection sets or create a 197 - > custom `keys` config for `???`. 198 - > Entities without keys will be embedded directly on the parent entity. 199 - > If this is intentional, create a `keys` config for `???` that always returns null. 200 - 201 - This error occurs when the cache can't generate a key for an entity. The key 202 - would then effectively be `null` and the entity won't be cached by a key. 203 - 204 - Conceptually this means that an entity won't be normalised but will indeed 205 - be cached by the parent's key and field, which is displayed in the first 206 - part of the warning. 207 - 208 - This may mean that you forgot to include an `id` or `_id` field. 209 - 210 - But if your entity at that place doesn't have any `id` fields, then you may 211 - have to create a custom `keys` config. This `keys` function either needs to 212 - return a unique ID for your entity or it needs to explicitly return `null` to silence 213 - this warning. 214 - 215 - ## (16) Heuristic Fragment Matching <a id="16"></a> 216 - 217 - > Heuristic Fragment Matching: A fragment is trying to match against the `???` type, 218 - > but the type condition is `???`. Since GraphQL allows for interfaces `???` may be 219 - > an interface. 220 - > A schema needs to be defined for this match to be deterministic, otherwise 221 - > the fragment will be matched heuristically! 222 - 223 - This warning is issued on fragment matching. Fragment matching is the process 224 - of matching a fragment against a piece of data in the cache and that data's `__typename` 225 - field. 226 - 227 - When the `__typename` field doesn't match the fragment's type, then we may be 228 - dealing with an interface and/or enum. In such a case the fragment may _still match_ 229 - if it's referring to an interface (`... on Interface`). Graphcache is supposed to be 230 - usable without much config, so what it does in this case is apply a heuristic match. 231 - 232 - In a heuristic fragment match we check whether all fields on the fragment are present 233 - in the cache, which is then treated as a fragment match. 234 - 235 - When you pass an introspected schema to the cache, this warning will never be displayed 236 - as the cache can then do deterministic fragment matching using schema information. 237 - 238 - ## (17) Invalid type <a id="17"></a> 239 - 240 - > Invalid type: The type `???` is used with @populate but does not exist. 241 - 242 - When you're using the populate exchange with an introspected schema and add the 243 - `@populate` directive to fields it first checks whether the type is valid and 244 - exists on the schema. 245 - 246 - If the field does not have sufficient type information because it doesn't exist 247 - on the schema or does not match expectations then this warning is logged. 248 - 249 - Check whether your schema is up-to-date or whether you're using an invalid 250 - field somewhere, maybe due to a typo. 251 - 252 - ## (18) Invalid TypeInfo state <a id="18"></a> 253 - 254 - > Invalid TypeInfo state: Found no flat schema type when one was expected. 255 - 256 - When you're using the populate exchange with an introspected schema, it will 257 - start collecting used fragments and selection sets on all of your queries. 258 - This error may occur if it hits unexpected types or inexistent types when doing so. 259 - 260 - Check whether your schema is up-to-date or whether you're using an invalid 261 - field somewhere, maybe due to a typo. 262 - 263 - Please open an issue if it happens on a query that you expect to be supported 264 - by the `populateExchange`. 265 - 266 - ## (19) Can't generate a key for invalidate(...) 267 - 268 - > Can't generate a key for invalidate(...). 269 - > You need to pass in a valid key (**typename:id) or an object with the "**typename" property and an "id" or "\_id" property. 270 - 271 - You probably have called `cache.invalidate` with data that the cache can't generate a key for. 272 - 273 - This may either happen because you're missing the `__typename` and `id` or `_id` field or if the last two 274 - aren't applicable to this entity a custom `keys` entry. 3 + If you are looking at this in a browser 4 + * ...and your URL looks like this: `github.com/FormidableLabs/urql/blob/master/exchanges/graphcache/help.md#15` 5 + * ...in the URL, replace `exchanges/graphcache/help.md` with `docs/graphcache/errors.md` 6 + * ...and keep the `#15` 7 + * ...and then you will get help with your error!
+3 -2
exchanges/graphcache/src/helpers/help.ts
··· 1 1 // These are guards that are used throughout the codebase to warn or error on 2 2 // unexpected behaviour or conditions. 3 3 // Every warning and error comes with a number that uniquely identifies them. 4 - // You can read more about the messages themselves in `docs/help.md` 4 + // You can read more about the messages themselves in `docs/graphcache/errors.md` 5 5 6 6 import { Kind, ExecutableDefinitionNode, InlineFragmentNode } from 'graphql'; 7 7 ··· 27 27 28 28 type DebugNode = ExecutableDefinitionNode | InlineFragmentNode; 29 29 30 - const helpUrl = '\nhttps://bit.ly/38yWDau#'; 30 + // URL unfurls to https://formidable.com/open-source/urql/docs/graphcache/errors/ 31 + const helpUrl = '\nhttps://bit.ly/2XbVrpR#'; 31 32 const cache = new Set<string>(); 32 33 33 34 export const currentDebugStack: string[] = [];
+3 -2
exchanges/populate/src/helpers/help.ts
··· 1 1 // These are guards that are used throughout the codebase to warn or error on 2 2 // unexpected behaviour or conditions. 3 3 // Every warning and error comes with a number that uniquely identifies them. 4 - // You can read more about the messages themselves in `docs/help.md` 4 + // You can read more about the messages themselves in `docs/graphcache/errors.md` 5 5 export type ErrorCode = 6 6 | 1 7 7 | 2 ··· 22 22 | 18 23 23 | 19; 24 24 25 - const helpUrl = '\nhttps://bit.ly/38yWDau#'; 25 + // URL unfurls to https://formidable.com/open-source/urql/docs/graphcache/errors/ 26 + const helpUrl = '\nhttps://bit.ly/2XbVrpR#'; 26 27 const cache = new Set<string>(); 27 28 28 29 export function invariant(