Closed aerni closed 3 weeks ago
This is a pretty weird edge case IMO. I'm not sure how we'd handle this.
Once you rename the folder away from how you've configured the dynamic folder, we are only maintaining the now-out-of-sync folder as a courtesy so selected assets don't break.
I don't think I fully understand. What's the point of the renaming folder feature if the fieldtype doesn't retain the new name? I understand what you're getting at, but the UX is super confusing right now.
It'll retain the name by looking at what assets you have selected in that field. If you don't have anything selected it has no idea that folder a
is the one that should be linked to that entry, so it'll go back to using whatever you've configured in the dynamic
setting.
In what situation are you uploading ~18 assets to a folder dedicated to a single entry, then choosing none of them?
Ah, I see. It's definitely an edge case, and I was only running into it when tinkering.
But the UX/UI is confusing right now. When first creating an entry, I'm under the impression that the dynamic folder has already been created. But the folder is only created once you upload the first asset. That's not inherently obvious because …
… The "Browse" button is present and allows you to browse a non-existing folder. … The "Rename Folder" action is present, making you believe that a folder already exists.
If you run the "Rename Folder" action, it would not actually "rename" but "create" a folder. And once you upload your first asset, it will be put into a folder with the name of whatever you've configured in the dynamic
setting. Leaving you with an empty folder from the initial renaming.
I'm not 100% sure what the best solution would be. Maybe hide the "Rename Folder" action from the UI until an asset has been uploaded and the folder created would suffice.
Bug description
I ran into an issue with dynamic assets folder and the rename folder feature.
Renaming a folder works as expected. However, if you later remove all the assets from the fieldtype, the folder name will be reset to whatever was set in the fieldtype config, like
id
orslug
. The fieldtype doesn't retain the name of the previously renamed folder. This leads to previously uplouded assets not being selectable anymore.Quick demo
https://github.com/user-attachments/assets/dcbacb1a-2966-4cd0-88c1-05896237bbee
How to reproduce
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response