Comments (8)
I noticed a very strange behavior. Sometimes it works correctly. Sometimes not. I was unable to understand the reason.
from strapi.
Which Waterline adapter are you using? I think the problem comes from Waterline... Sometimes it seems the values are not populated in the response object.
from strapi.
@Aurelsicoko i'm using sails-mongo
, but there is a possibility that it is buggy at the default settings.
I will try to create a new application, without any additional adapters. I'll let you know about the results here.
from strapi.
I tested it on a new application. Here's what happens:
Standard API gives data correctly.
[
{
"contributors":[
{
"username":"kulakowka",
"email":"[email protected]",
"lang":"en_US",
"template":"default",
"id_ref":"1",
"provider":"local",
"id":1,
"createdAt":"2016-01-31T23:19:54.227Z",
"updatedAt":"2016-01-31T23:19:54.237Z"
}
],
"comments":[
{
"content":"Comment 1 for article 1",
"lang":"en_US",
"template":"default",
"createdBy":1,
"updatedBy":1,
"article":1,
"id":1,
"createdAt":"2016-01-31T23:21:16.614Z",
"updatedAt":"2016-01-31T23:21:29.139Z"
},
{
"content":"Comment 2 for article 1",
"lang":"en_US",
"template":"default",
"createdBy":1,
"updatedBy":1,
"article":1,
"id":2,
"createdAt":"2016-01-31T23:21:31.371Z",
"updatedAt":"2016-01-31T23:21:39.347Z"
}
],
"createdBy":{
"username":"kulakowka",
"email":"[email protected]",
"lang":"en_US",
"template":"default",
"id_ref":"1",
"provider":"local",
"id":1,
"createdAt":"2016-01-31T23:19:54.227Z",
"updatedAt":"2016-01-31T23:19:54.237Z"
},
"updatedBy":{
"username":"kulakowka",
"email":"[email protected]",
"lang":"en_US",
"template":"default",
"id_ref":"1",
"provider":"local",
"id":1,
"createdAt":"2016-01-31T23:19:54.227Z",
"updatedAt":"2016-01-31T23:19:54.237Z"
},
"title":"Article 1",
"content":"Test for article 1",
"lang":"en_US",
"template":"default",
"id":1,
"createdAt":"2016-01-31T23:19:59.536Z",
"updatedAt":"2016-01-31T23:20:10.032Z"
},
{
"contributors":[
{
"username":"kulakowka",
"email":"[email protected]",
"lang":"en_US",
"template":"default",
"id_ref":"1",
"provider":"local",
"id":1,
"createdAt":"2016-01-31T23:19:54.227Z",
"updatedAt":"2016-01-31T23:19:54.237Z"
}
],
"comments":[
{
"content":"Comment 1 for article 2",
"lang":"en_US",
"template":"default",
"createdBy":1,
"updatedBy":1,
"article":2,
"id":3,
"createdAt":"2016-01-31T23:21:41.160Z",
"updatedAt":"2016-01-31T23:21:52.418Z"
},
{
"content":"Comment 2 for article 2",
"lang":"en_US",
"template":"default",
"createdBy":1,
"updatedBy":1,
"article":2,
"id":4,
"createdAt":"2016-01-31T23:21:54.028Z",
"updatedAt":"2016-01-31T23:22:03.647Z"
}
],
"createdBy":{
"username":"kulakowka",
"email":"[email protected]",
"lang":"en_US",
"template":"default",
"id_ref":"1",
"provider":"local",
"id":1,
"createdAt":"2016-01-31T23:19:54.227Z",
"updatedAt":"2016-01-31T23:19:54.237Z"
},
"updatedBy":{
"username":"kulakowka",
"email":"[email protected]",
"lang":"en_US",
"template":"default",
"id_ref":"1",
"provider":"local",
"id":1,
"createdAt":"2016-01-31T23:19:54.227Z",
"updatedAt":"2016-01-31T23:19:54.237Z"
},
"title":"Article 2",
"content":"Text for article 2",
"lang":"en_US",
"template":"default",
"id":2,
"createdAt":"2016-01-31T23:20:11.033Z",
"updatedAt":"2016-01-31T23:20:19.405Z"
}
]
But graphql response has wrong data:
http://localhost:1337/graphql?query={articles{id,title,createdBy{id,username},comments{id,content}}}
{
"data":{
"articles":[
{
"id":"1",
"title":"Article 1",
"createdBy":{
"id":"1",
"username":"kulakowka"
},
"comments":[
{
"id":"1",
"content":"Comment 1 for article 1"
},
{
"id":"2",
"content":"Comment 2 for article 1"
},
{
"id":"3",
"content":"Comment 1 for article 2"
},
{
"id":"4",
"content":"Comment 2 for article 2"
}
]
},
{
"id":"2",
"title":"Article 2",
"createdBy":null,
"comments":[
{
"id":"1",
"content":"Comment 1 for article 1"
},
{
"id":"2",
"content":"Comment 2 for article 1"
},
{
"id":"3",
"content":"Comment 1 for article 2"
},
{
"id":"4",
"content":"Comment 2 for article 2"
}
]
}
]
}
}
I did not make any settings other than the relationship between the models.
Maybe I'm wrong to set up a relationship between the models?
from strapi.
No, your relationships look good. I will take a look at it tomorrow There is an issue but it's strange because we didn't notice this before. The GraphQL support has not been updated for 2 months.
from strapi.
I found something strange. Take a look at the screenshot:
I do not know whether it is right or not. But it looks strange.
Perhaps this is a bug in the admin panel?
When I switch on the fields Relations
Preview looks like this
Then I switch to a different field
Preview looks like this
Nothing but the name does not change. Although it is obvious that the scheme should be changed.
from strapi.
Fixed! I had the same behavior. Thanks for your detailed feedback.
from strapi.
I'm glad to help you.
from strapi.
Related Issues (20)
- Only debug mode : Undefined binding(s) detected when compiling WHERE. Undefined column(s): [t0.id] query: where t0.id = ?
- Email.template.reset_password translation is missing
- Chinese translation lost HOT 2
- Odd number generated every time a new entry is created
- Selecting multiple "Add relation" in a Collection Type too quickly causes the tab to become unresponsive.
- Typeof - date (ex: 01/01/2024) field decrements from the selected date
- [V4] TS Global Middleware not picked up HOT 3
- Single Type Leads To 404 NotFoundError HOT 1
- [BUG] [Strapi v5 Beta]`defPropValFN` is not a function HOT 2
- On npm run build getting issues regarding typscript in my Strapi project
- [v5] Cannot populate multiple relations to the same table using the REST API and Document Service API
- error while custom table migration to mysql
- On Initial Install Get "You don't have permission to access content error" when looking at User collection type until you refresh.
- [GraphQL] The `isDefault` field from the i18n plugin locale is missing in the `I18NLocale` GraphQL type
- admin_ui::Uncaught Error while adding component in dynamic zone HOT 1
- admin_ui::Uncaught Error while adding component in dynamic zone
- webpack.DefinePlugin is not a constructor on yarn build
- Throw ApplicationError in lifecycles.ts doesn't show error in admin panel
- User cache is not cleared when logging out and logging in as a different user
- users aren't redirected to the /usecase page anymore after telemetry accepted
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strapi.