Skip to content
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

"Used On" tab not updating when selecting subsequent files in the file browser #1834

Open
2 tasks done
jack-nzl opened this issue Oct 9, 2024 · 1 comment
Open
2 tasks done

Comments

@jack-nzl
Copy link

jack-nzl commented Oct 9, 2024

Module version(s) affected

2.2.13

Description

When a file is selected in the file browser, its usage information is displayed under the Used on tab. However, if another file is subsequently selected, the Used on tab does not update to reflect the new file's usage information.

To view the correct usage information for the newly selected file, currently you have to click on the Details tab and then reselect the Used on tab.

How to reproduce

  1. Navigate to the file browser and select any file (can be any file type) that is currently being utilised on a page
  2. Click on the Used on tab to view the page(s) where the selected file is in use
  3. Without deselecting the Used on tab, choose another file that is also being used on a page
  4. Notice that despite the new file being in use, the message displayed is "This file is currently not in use." indicating that the Used on tab did not update correctly with the selection of the new file

Possible Solution

It looks like the usage method on the UsedOnTable class is not being fired when clicking on a subsequent file due to the Used on tab already being selected.

If you repeat the steps and get hit with the "This file is currently not in use." message, and then select the Details tab and then select the Used on tab again, the correct pages show.

So possibly need to make sure that the usage method is being properly fired when selecting a subsequent file

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)
@sunnysideup
Copy link

sunnysideup commented Nov 29, 2024

Hi,

I have two notes here - that might be helpful. Not directly related, but give some additional info:

1

I noticed that in a large install, the "Used On" is often empty and then after a few loads (click on another image, click on the original image, etc...), it starts loading the data correctly. Is that because it is loaded through ajax async with React in the mix?

2

There is no canView check for any of the related objects AFAIK. This exposes the Existence, Title and Link of a DataObject to users where canView returns false for those. This could be added here: vendor/silverstripe/admin/code/Forms/UsedOnTable.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants