Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between "Document" and "Slice" field. #116

Closed
rqelibari opened this issue Mar 13, 2019 · 3 comments
Closed

Difference between "Document" and "Slice" field. #116

rqelibari opened this issue Mar 13, 2019 · 3 comments

Comments

@rqelibari
Copy link

rqelibari commented Mar 13, 2019

Hi,

what exactly is the difference between a "Slice" and a "Document" field. "Slice-Content" seems to be just another "Content Type", with the restriction, that it may no be queried directly, but instead has to be referenced in a "Slice" field of a standard "Content Type".

Am I right, when I think of a "Document" field named myField to correspond to the following GraphQL schema:

[...]
union MyFieldDocument = SomeType1 | SomeType2

type MyContentType {
    myField: MyFieldDocument!
}
[...]

If that is right, what exactly does "Slize" correspond to?

@birkir
Copy link
Owner

birkir commented Apr 9, 2019

Document is a field that you can reference another documents with many-to-many relationships.

Slice is a field that allows slices (like documents) within your document that has one-to-many relationship.

I am re-using ContentType to store the schema of the two, but fundamentally, they are different. The UI is a little bit confusing, and I tend to fix that soon.

Document(Author)[] <> Document(Blog)[]
Document(Blog) > Slice(Foo | Bar | Baz)[]
Document(Author) > Slice(Baz | Foo)[]

Nobody owns documents content
Document owns Slices content

@birkir birkir closed this as completed Apr 9, 2019
@intellix
Copy link
Contributor

Was also wondering the same thing actually. Used the Deploy to Heroku feature and am playing around with Prime.

I can add a Document and pick both Slices and Documents, which lead me to confusion but I think it shouldn't be allowed? After having a Document field with both documents and slices I get errors after visiting the Documents page:

Screenshot 2019-05-16 15 40 02

Screenshot 2019-05-16 15 39 47

@birkir
Copy link
Owner

birkir commented May 20, 2019

Yes, that should not happen. I am hoping to be able to update the UI to not show Slices in the Schema tabs (Content Types/Templates/Slices) but rather inside Content Types themselfs.

However I want them to be shared between content types too, so I will figure something out there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants