craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

Live-Preview-Refresh-Rate-Setting #3463

Closed herrajon closed 3 years ago

herrajon commented 5 years ago

Howdy

This is a feature request

One of the most powerful features Craft ships with is its ability to present the live content for its content-editors almost seamlessly on the fly. Live Preview.

Live preview updates new settings/adding new content in something around and about three seconds so the user will not lose the touch in continuing his writings and composure usually based on high Bordeaux consumption and choice of mildly blended tobacco.

Some of them though lag behind bad internet connections and usage of old and rusty hardware. So fast (3secs) update is sometimes something to whine about.

A setting in general.php for the Live-Preview-Refresh-Update-Rate would be a pleasant add on to this almost heavenly software. This would be 'a nice to have'.

Just saying and thank you for reading I would ask you to forgive me for the grammar and spelling but I am shameless.

Yours lovingly Herra Jón

narration-sd commented 5 years ago

Hi Mr. Jón,

I notice @brandonkelly has already set this as a feature request, and I may be able to add some thought since I am completing a feature plugin which adds to Craft's abilities in Live Preview. You may particularly want to look at the point about extra server delays that affect Live Preview strongly, due to xdebug or Craft devMode being enabled. And Brandon may like to look at the lower section, where there's a reason I suggest where your feature could turn out unexpectedly useful.


Ok, and the last point leads to actually a possible reason for this controllable update delay feature, even though I think it will not help you speed up your client's experience. Here's the explanation for that, for which I thought Brandon may be especially interested:

a. It's a general case that as application screens get more complicated, problems with Live Update can arise. When only Twig is used, the screen will arrive all at once, but not necessarily all of its data -- think of image assets, or anything else that might be filled in by Ajax or direct remote calls.

b. As soon as you introduce modern frameworks such as Vue or React into the picture, it gets more complicated. Now you really do have delayable portions of the screen, which proper js app design will keep undisplayed until their data arrive. Vue etc. have features especially for this.

c. The result is that the layout may be unstable early in a screen update -- first some information will show, and later the screen will shift as the rest arrives and is laid out, painted.

c. Especially, this can cause the display to change scroll position, and lose what you were looking at for the Live Preview. Vue has a feature to remember and restore scroll position, which is effective against this, restoring position as the screen becomes built -- mostly.

d. The problem is the 'mostly' comment. My experience so far is that restoration works perfectly when the server is remote, and thus more simply delayed. This is so even or actually especially when the delay is larger, as in your situation at present.

e. However, I've seen a situation where it doesn't always work, where the scroll position can intermittently get lost, and so the Live Preview slip away from showing the information you are interested in. That's when xdebug is active, and browser and server are on the same machine, Windows and using a VM (VMware) at least. Even with a very powerful CPU, it looks like there can be unexpected interruptions, due to interleaving, which cause the browser display and instructions to fall out of sync.

f. Without getting further into this edge case, I don't think it will come up in normal server operation -- but it could; we will have to see. If it did, then the ability to tame the update rate, by using a settable delay as you propose, could be a key to usefulness. So that's my addition to justifying your idea.


Last to say, there is a related feature which can be very helpful in Live Preview, whether it is now on Twig or some future framework, and that is the ability to focus on only one element of multiple content.

The example would be to be editing one slide of a carousel. Then you'll want Live Preview to show you just that slide -- but if it is a carousel, only the first slide will appear 'held' this way. For later slides, you'd have to wait or manually move the slider to see your changes -- each update... This will rapidly become tedious.

Many have noted feature need in this area. The feature I've propose, I believe could make a very smooth solution, which is to give Matrix (and by extension other multiple content fields, including plugin Neo etc.) a 'Solo' button. Then they would work like audio workstation software (and a manual studio console) does, and just 'play' the element you are interested in, until you release Solo.

This will effectively stop a rotating carousel on the slide you want to work on -- and nondestructively so that it resumes again when you are finished. In fact, I'm adding the idea that Solo should automatically cancel on Entry Save, so that it will do that without any editor attention.

The FR issue for Solo is here: https://github.com/craftcms/cms/issues/3116


p.s. Driving a 4WD across from Akureyri to Reykyavik, right after a winter blizzard, was just one of many great experiences once, visiting Island -- many interesting and characterful memories of persons there, so thinking a moment of your good fortune, HerraJòn ;) .

narration-sd commented 5 years ago

edited - splits for clarity

herrajon commented 5 years ago

@narration-sd : I am glad, you made it back alive. I hope we did not bankrupt you while staying here. But as you know an Icelandic Blizzard in the Interior during the winter is Priceless. Now we share the meaning of 'lost' together.

Thank you @brandonkelly for adding this as an enhancement.

@narration-sd These are really ravishing findings that you write here. It certainly will help me to understand this process better and also gives me insights into things I did not really know to exist. I am a better man now I admit.

But the request still stands. When my grandmother is blogging about these Polish guys that drove into the 'Jökulsárlón' and that American people actually like to pay for watching whales and not eat them; on her new Amiga then she gets really irritated when the screen 'blinks' without her permission.

To be able to set the update to twelve seconds and tell her that she has twelve seconds before blink would really improve my Grandfathers mental health.

But I understand now that there is more to 'Live Preview' than meets the eye. A kind of a blizzard really.

narration-sd commented 5 years ago

@herrajon ha - Fortunately I did not drive into the Jökulsárlón myself, though I did stop to view Thingvellir of own-background Nordic fame and remarkable beauty in winter also -- after a young woman whose beauty I still remember filled up petrol in some small town nearby.

It was actually clear skies after the blizzard, just very snowy across the land, and I had checked weather to arrive of course. Though looking back those 'few' years, maybe a younger version wasn't quite as wise as he thought to matters, having lived a year earlier elsewhere in the Arctic...things we learn....

Anyway, you are certainly reminding me of wit I met, and really giving a smile. I had really hoped @angrybrad would have had some of this, as he stopped on the way to Berlin and back, but looks like it was not to be, this time.

We have to help your Grandmother's blinks, and preserve both grandparents' relationships, definitely. Thinking more of those women, and their intricate character, I will not after all pity your Grandfather ;)

As well, historic computers should not be made to exert too hard...

To finish, you have said more even than you may think, in observing Live Preview in all its potentialities as a blizzard.

I have well been there, and I can say....! Clive

narration-sd commented 5 years ago

edit again (bad habit, but helpful, saying something about Live Previews, even vs. available un-alive Previews)

narration-sd commented 5 years ago

p.p.s. @herrajon maybe since it's in the season, I thought a novel of Ursula Le Guin's might give a particularly enjoyable surprise, if you haven't found it already. That's 'The Left Hand of Darkness'.

You can find it on its own easily, this winter world with much else, but looking on Amazon UK, since that's where it went when I tried amazon.is, this compilation might be well worthwhile, as it contains also the fine 'The Dispossessed', and several others of her stories.

https://www.amazon.co.uk/Ursula-K-Guin-Hainish-Hardcover/dp/1598535382

p.s. of p.s. @brandonkelly yes, I am that incorrigible -- as also someone else, that I might know?? ;)