Closed piotrpog closed 5 years ago
Are you sure this is a request that Craft considers to be AJAX? I do test for this:
https://github.com/nystudio107/craft-templatecomments/blob/v1/src/TemplateComments.php#L91
How exactly are you loading this template? Code would help.
If you're using Axios, you need to add the appropriate headers:
const VueAxios = axios.create({
headers: {
common: {
'X-Requested-With': 'XMLHttpRequest',
},
},
});
Will re-open if further info is provided
@khalwat I've just encountered this. Running Template Comments 1.1.0, Craft 3.1.34.3.
We are using Axios to fetch the page over ajax, and we are sending the correct headers.
In TemplateComments::addComponents()
you are testing for & aborting if the request is an AJAX one, however in TemplateComments::installEventListeners()
you are not doing the same. Far as I can tell this is what's causing it.
Doh... this now breaks the CLI because isAjax()
isn't available in the console. Sorry I didn't think of that when I suggested the fix. :(
lol -- my bad, I should have known that
I encountered strange error today. I tried query template file using ajax. This template is just twig file in
templates
folder, and it worked fine when browsed it manually trough browser. But when I tried ajax, it returned error:It happened multiple times, not just one ajax request.
I figured it might have something to do with template comments plugin so i disabled it. And error disappeared. Most interesting thing is that when i enabled plugin again, problem did not appeared again.
My system info:
PHP version 7.2.1 Database driver & version MySQL 5.5.5 Image driver & version GD 7.2.1 Craft edition & version Craft Solo 3.1.5 Yii version 2.0.15.1 Twig version 2.6.2 Guzzle version 6.3.3 Imagine version 0.7-dev Plugins CP Field Inspect 1.0.5 Element Map 1.2.1 Enupal Translate 1.2.0 Imager v2.1.4 Image Resizer 2.0.4 Imager Pretransform 2.0.2 MobileDetect 1.0.2 Position Fieldtype 1.0.14 Redactor 2.3.0 Retour 3.1.5 SEOmatic 3.1.39 Smart Map 3.2.1 Super Table 2.1.5.3 Template Comments 1.0.5 Typed link field 1.0.16 Wordsmith 3.0.4