Skip to content

Too much requests towards /assets-fieldtype when editing an entry with multiple Asset fields #10531

Open
@lyyka

Description

@lyyka

Bug description

We have a blog which contains a table, and each table cell can be an image or a text.

When you have a lot of images inside the content (this is just an example, but it does not have to be a table), Statamic makes 1 POST request to /assets-fieldtype PER image. With one of our blogs, that calculates to ~230 POST requests dispatched at the same moment towards our server.

Can't this be done in bulk? This is very heavy load, considering that multiple people may work in parallel on different blogs, which all can have a lot of images. That would be a lot of requests per second towards the server.

Also, if the same asset (for example x.svg) from the same container is being used multiple times inside the blog content, CMS will call the API each time to get the same asset over and over again. Maybe cache the asset data locally based on it's name?

How to reproduce

Write a blog with a lot of images in it. Watch how the POST request count in Network tab increases witch each new image you add.

Logs

No response

Environment

Environment
Laravel Version: 10.48.15
PHP Version: 8.2.21
Composer Version: 2.7.6
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: single
Mail: smtp
Queue: sync
Scout: collection
Session: file

Livewire
Livewire: v3.5.2

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 3.8.2
PHP SDK Version: 3.22.1
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 6
Sites: 5
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.17.1 PRO

Statamic Addons
jacksleight/statamic-bard-mutator: 2.3.1
studio1902/statamic-peak-browser-appearance: 3.5.0
studio1902/statamic-peak-commands: 8.3.2
studio1902/statamic-peak-seo: 8.15.3
studio1902/statamic-peak-tools: 6.3.0
thoughtco/statamic-blurhash: 1.1.0

Installation

Existing Laravel app

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions