-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
page medias: bad performances and bad practices in admin #788
Comments
You shouldn't be using PageMediaSelect, that is deprecated. PageMediaSelect was never intended to be used more than once, it was internally used for the Content area. We already fixed this with the More details: |
But OK I'ill try the new |
Then that's not supposed to happen. It should only load data when you focus on the field. And also it wouldn't matter if you had 3 of those, the ajax request will be cached at that point. @flaviocopes ? Btw, your first image of |
And finally, we already started discussing internally how to best approach #779. We have a good plan of attack that would solve the upload of big images. They will be automatically resized and resampled the moment an image is selected for upload. |
in my case, it happens
uploading big images in a CMS is a very very common scenario, and performance is in the highest priorities for a good user experience. Customers no wonder if the back office is slow because of their upload size, and developpers expect from a CMS that is resilient. You have maded an extremly powerful CMS, but please dont forget the basics ;) edit: gosh sorry if I sound arrogant! (not my intention...) |
Ok, the problem is more important than I thought. If I have a slow connection, or a slow server, and the BUT, if I edit my page (for example the title), without waiting that all the It's a HUGE design problem. in this example, we can see: |
Hey @maximelebreton, There's nothing else we can do here until we get down to approach the issues, it might take time because there are other things we are looking at as well. My only suggestion for you is to just go ahead and manually resize those images to a more reasonable size. Your site and slow connection will benefit from it immediately and it will at least keeps you running until we look into the issues. Cheers. |
I know you already acknowledge these two issues, but I raised a new one, who's when you're saving a page, if a So this is a strong issue, but for me, this shows a bigger problem that is situated in the js core architecture. Grav needs strong javascript foundations in admin for these kind of complex interactions, and I don't understand why most of Grav is built on top of best-class technologies like Twig, Markdown, Symfony, but the javascript admin client is not, when robust view library's like React would be so relevant? What do you think? |
There is no such thing as a blank temporary value. The value is always loaded separately in an hidden field with all the JSON data that gets stored, no matter if it takes 2 minutes for your images to load. So what you are describing has nothing to do with the JS architecture like you say, I think you are just wrongly interpreting what's going on. There is an issue with files and collections which I'm quite sure it's what you are experiencing (#775). That said, I would love to use React of course, but It's a huge rework that we are not going to face at this moment. I'm also not quite sure it will solve your issues anyway. Overall there is very little JS going on in the admin, aside from some simple DOM manipulation here and there and a few ajax requests, most of the work happens via PHP. Just because we use vanilla JS for the most part, doesn't mean it's not built on top of best-class technologies or best practises. We use ES6 (including fetch), Mutations, Observers and Stateful-ness when needed. React is an amazing piece of work and I would definitely love to use it at some point, but at the moment it doesn't feel like it would add much to Grav Admin. There is probably only a few places where React could help a lot: collections and arrays. Otherwise I think we are pretty good as is. So to recap, it seems like you are experiencing many different issues, some already reported by others, some related by your very slow connection (what connection do you have btw?). There is no such thing as values getting lost because the images take too long to load, in fact, the issue has nothing to do with JS at all, nor the architecture of it. Please make your images smaller until this issues get resolved, that will solve many of your issues and at least we don't go in circle repeating the same things. |
Sorry if i'm wrong, i'm just trying to help. What i described as 'blank value' is the grav behaviour when there is no value (value is removed from the .md file) and there is no duplication, like in #775 blueprint:
original .md file:
after .md file (if saving when
|
I completely reworked the logic of this field. It was simply wrongly loading data via ajax at every page load. This was always meant to load data only when the field gained focus. It is also never going to show a preview image next to selected value of filepicker (on load). However if you activate the dropdown and get the data, then the selected field will get the preview. There is a dramatic boost in speed now, it is very optimized. |
So this is turning into a rather unwieldy issue, but I just wanted to ensure that the proposed solution you described for #779 wouldn't alter the images that ended up in the actual page folder, @w00fz? Using very big images might not be optimal, but downsampling in the browser can produce very different results depending on your browser, and would just generally be unexpected behavior IMO |
Thanks @w00fz for handling this, looks like a combination of not optimized filepicker + a slow response of the files list from the server. Going to test it with big images + a slow connection simulation to make sure even with low performance and high load it's behaving as intended. |
As a reminder, I never said I had a slow connection. |
I have a custom page, with two
PageMediaSelect
perList
field.And with only four items based on the same
projects.json
, it takes about 25s to load* all thePageMediaSelect
fields, because the same request is called 9 times, and these requests aren't cached...I'm surprised about the lack of good practices** with all that concerns 'Ajax' & Performance (#779, #741), because these are basic things, and Grav provides many more complex scenarios with success!
So maybe the admin performance part needs a serious investigation and refactoring?
*on a PlanetHoster mutualised server
**store JSON results in a variable or in local storage, & PHP Caching and Content Retrieval Function
ps: I try to make constructive feedback, I love Grav, and your amazing job guys
The text was updated successfully, but these errors were encountered: