Why use IntrospectionFragmentMatcher? - apollo

Is there any reason to use IntrospectionFragmentMatcher to determine concrete types of values returned from interface and union fields?
I'm talking about apollo-client. I'm using InMemoryCache with addTypename: true, so the type is known the moment the client gets the response.
Meanwhile my console is plagued with warnings like these:
The only reason I see the documentation hint at is response validation. But why validate the server-sent response at all? If the server is not worth trusting, validation is useless anyway.

The warnings seem to be a bug in apollo. https://github.com/apollographql/apollo-client/issues/3397

If you're using useQuery then try fetchPolicy: 'no-cache'.
this solved my issue.
Only a fix if you're not using cache properly

Related

Getting error: "The content-type is not JSON compatible" after a period of time

I'm not really sure exactly how long it takes before I get this error, but after a period of time, I get "The content-type is not JSON compatible" error. I am able the query just fine from graphql playground but not in my app. I am using persisted queries, so not sure if that is the cause.
The only fix is to restart my app.
Here is the
stacktrace
Based on the stacktrace you posted I can see that the server (in particular, probably the resolver for whatever query/mutation you are sending) is returning something unexpected i.e. not "JSON compatible".
Based on what you provided, that's all I can say. Please add more details and I can provide additional help. Just including the stacktrace is not enough to determine the cause of this issue.

How to use a variable in Postman example response header

We are using examples to populate our Postman mock server. This works out well, except for the tests I've written for the response headers.
In my example I've got a header that is named Location and it's value is {{url}}/whatever/{{id}}. In my tests I see only the value /whatever/, the other variables have not been substitued (they have been substituted in the response body).
What am I doing wrong here?
Did not get it. Where wasn't it substituted? like you said:
the other variables have not been substitued
where is it?
In my tests I see only the value /whatever/
in which tests, where exactly?
Basically, there can't be any difficult situation with it for any people who works with postman at least a month, so I guess the question is hidden in more extended explanation.
Guess this was a bug that has since been fixed, this no longer happens (I tried to delete the question, but SO doesn't let me)

How to add client side validation errors in Ember Data?

What is correct way for handling client side validation errors? DS.Model class has methods add and clear that work fine for me, but both are marked as deprecated. What is replacement for those methods?
Not sure that about correct, but there is a library that can save you some time. If you look at this project you will see how it is used with ember data.
https://github.com/esbanarango/ember-model-validator#user-content-usage-example
In short you have mixin import Validator from '../mixins/model-validator';
that you import to your model and define validations rules.
People from DockYard also wrote a great add on for EmberObjects which you can check here
https://github.com/DockYard/ember-validations
For me personally this is too much. I prefer to do validation on server side - I am using ActiveModelSerializer and responding to for example 200 or 201 when success and 422 or 401 when unable to process entity or permission denied. This path will use DS.Error object which you can check here...http://emberjs.com/api/data/classes/DS.Errors.html. The sample easy code would be
model.save().then ( (data)=>, (error)=>...
Then in your template code you could use following
{{#each model.errors.MYFIELD as |error|}}
I can provide more specific example but your question is generic one.
Hope it helps

Update Objects and reset the isDirty-flag (ember-data 1.0 beta.2)

With former versions of ember-data I could bring a modified model back to clear-state by calling:
user.transitionTo('loaded.saved')
Is there a way to do this in version 1.0beta.2? The main reason is to suppress any server requests when saying
user.save()
[Edit] - I didn't explicitly mention, that my intention was to keep the modified values, just resetting the dirty-state.
What I really wanted to do is updating some fields of a record w/o setting the dirty flag.
store.update(type, hash)
here: http://emberjs.com/blog/2013/09/04/ember-data-1-0-beta-2-released.html
does right that.
I responded over at Discourse, too, but for the sake of completeness:
user.rollback() does what you aim to do, judging from the source code.

Hash anchor tag causing errors in URL

On very rate occasions, my error log is showing the following error:
"You specified a Fuseaction of registrationaction#close which is not defined in Circuit public."
The full link is:"http://myUrl/index.cfm?do=public.registrationAction#close"
As you can see, the has merely points to an anchor (close) on the page.
This code is working 99% of the time, but on the odd occasion, Coldfusion / Fusebox throws this error out.
Why is this happening?
Could it be related to the device accessing my page somehow? Like a cell phone or Apple product that for some reason does handle hashes the way I am expecting it to?
Could it be javascript / JQuery being disabled?
Any guidance would be appreciated
Thanks
I used to see stuff like that. Older versions of Internet Explorer were not handling the hashtag properly when there were URL parameters. The best solution I could come up with was kludgey at best, but basically it forced the anchor tag to separate from the URL parameter.
http://myUrl/index.cfm?do=public.registrationAction&#close
I'm not sure there is a simple answer to this. We get odd exceptions all the time on our site for all sorts of reasons. Sometimes it's people not using the site the way you expect and sometimes it stuff like you mention such as user-agent edge cases etc.
Basically you need to start to gather evidence and see what comes up that's unusual with these requests.
So to start: do you catch exceptions in you application? If so dumping all scopes (CGI/CLIENT/FORM/URL/SESSION) in an email along with the full exception and emailing them to a custom emails address (such as errors#yourdomain.com) will give you a reference you can square up to your error times and this might give you a hint as to the real issue.
Hope that helps some!