question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: Slice Variations Usage

See original GitHub issue

Summary

Improving slices workflow for developers by preventing code duplication and for content writers by improving the writing room with a new feature allowing variations of a same slice. This thread is meant to discuss their usage more than the actual interface.

Concept

The concept of slice variation is about allowing variations within fields used/displayed in the writing room for a given slice. Goals of them are to:

  • Improve the writing room interface, only fields relevant to the current variation are being displayed to the content writer;
  • Turning slice labels into variation, therefore empowering developers to create more powerful slices.

Example

Considering a SimpleHero slice with two variations:

image

For the Basic variation, the editor will only display those fields:

  • Title (title);
  • Description (rich text);
  • Featured Image (image).

For the With CTA variation, the editor will also come with additional fields inside its repeatable zone:

  • CTA Link (link);
  • CTA Label (key text).

To Consider

1. What is happening to fields content if the editor switch from the first variation to a second?

Using the above example if the content writer was using the With CTA variation but decide to switch back to the Basic one:

  • What fields are returned by the API?
  • If they switch back to the With CTA variation are fields resumed?

2. What is happening if two variations feature a field with the same API ID but the field type is actually different?

Considering a TextMedia slice with a variation with an image field under the API ID media and another variation with an embed field under the same media API ID

Related

Discussing GraphQL/GraphQuery interface for Slice Variations

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
Duanercommented, Jan 20, 2021

Hey all thanks for the great feedback, it’s fantastic to have your input on that.

I completely agree with you @ReeceM we were thinking about that from the beginning of the project. We will support the content migration from a variation to another as soon as the field is having the same key in both variations.

For the design, we were thinking about something like that. Does it correspond to what you’re looking for @davidparys?

téléchargement (2)

Let me know what you think

3reactions
hv-provcommented, Jan 29, 2021

I have another perspective on variations, so allow me share my 2 cents 😊

To me, variations are not satisfying in their current state: the fact that variations don’t truly share fields (just copies of configuration) brings a lot of overhead and is error prone on the long run. Pretty much like sharing slices between custom types before we introduced real shared slices.

Because fields are not shared, changing a field in one variation won’t rapport the change in other variations, although you would tend to think it does. It also means that you’d have to manually propagate a change everywhere. Preserving state between variations in the editor would be somewhat possible but subject to errors too: consider 2 RichTexts with different options: copying content 1 to content 2 might break the constraint on content type (which would let the editor in a pretty weird state).

It’s also much more difficult to handle in the editor and forces everything to be scoped: Storybook stories, both automatic and custom screenshots and mocks. I guess this part is not a major blocker of course 😊

Something I really like at Prismic is that we try to consider if a new feature enforces better practices before releasing it, but following @lihbr 's second message: as is, variations could be used both well and poorly. They require to be thought through carefully and by experience, we know that modelling things the right way is hard, especially in your first projects.

That being said, I would love to be able to preview variations screenshots in my editor, whatever variations mean!

Read more comments on GitHub >

github_iconTop Results From Across the Web

0198-slice-notation - The Rust RFC Book
This RFC adds overloaded slice notation: ... via two new traits, Slice and SliceMut . It also changes the notation for range match...
Read more >
draft-ietf-teas-ietf-network-slices-17 - A Framework for IETF ...
A Framework for IETF Network Slices (Internet-Draft, 2022) ... Packet Delay Variation Metric for IP Performance Metrics (IPPM)", RFC 3393, ...
Read more >
Cisco's Enhanced Interior Gateway Routing Protocol (EIGRP)
EIGRP uses the Source Node Condition stating that a neighboring router meets ... Routers that are not affected by topology changes are not...
Read more >
Documentation: 15: 8.14. JSON Types - PostgreSQL
Slice expressions are not supported. The result of a subscripting expression is always of the jsonb data type. UPDATE statements may use subscripting...
Read more >
RFC-0005: Blobfs snapshots - Fuchsia
Design ; A/B bitmap · This would be an extent of slices that have an alternate copy of a bitmap that represents allocations...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found