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

Action doesn't work if applied to resource that is found via index search #6518

Closed
bosniakus opened this issue Sep 4, 2024 · 5 comments
Closed
Assignees
Labels
fix incoming A fix is in review

Comments

@bosniakus
Copy link

bosniakus commented Sep 4, 2024

  • Laravel Version: 11.9
  • Nova Version: 4.35.0
  • PHP Version: 8.2
  • Database Driver & Version: mysql
  • Operating System and Version: Windows 11 (Herd)
  • Browser type and version: Firefox / 129.0.2 (64-bit)
  • Reproduction Repository: ---

Description:

I have model 'Category' and action 'Add parent to category' which have 'Parent' field (BelongsTo). Everything is set up correctly and it works as intended. If, for example, I choose category 'Aston Martin' and add parent category 'Car' to it via action 'Add parent to category' it works.

/resources/categories?categories_page=1 - Action on this URL does work!

Issue appear when I use index table search field. Once resources I want to use action on are found, action does not work with error message "This Parent may not be associated with this resource."

/resources/categories?categories_page=1&categories_search=aston+martin - Action on this URL does NOT work

This error message is pretty consistent. I tried to refresh page, to select different parent category without luck.

Detailed steps to reproduce the issue on a fresh Nova installation:

  • Create Model
  • Create action that change 'parent_id' on created Model via BelongsTo field
  • Search for Resource you want to apply action on
  • Apply action

image

@jeremynikolic
Copy link

Hi @bosniakus , thanks for reporting this.
I am unsure I understand the full setup you have, therefore making it hard to reproduce.

Please share a sample reproducing repo or code example of how you have set those two models and the mentioned action 🙏

@crynobone crynobone added the needs more info More information is required label Sep 5, 2024
@bosniakus
Copy link
Author

bosniakus commented Sep 5, 2024

Hello @jeremynikolic ,

Here is bare minimum repository where you are able to reproduce this issue/bug : https://github.com/bosniakus/laravel-nova-action-bug

Steps to reproduce:

  • Create two categories ( "child" and "parent" )
  • Try to use action "Add category parent" - It should work
  • Search for "child" using index table search
  • Once found try again to use action "Add category parent" again - This wont work

Let me know if you need more information.

image

@jeremynikolic
Copy link

Thanks @bosniakus I'll be looking into it 🕵️

@jeremynikolic jeremynikolic self-assigned this Sep 5, 2024
@jeremynikolic jeremynikolic added pending Issues that are pending triage and removed needs more info More information is required labels Sep 5, 2024
@jeremynikolic
Copy link

jeremynikolic commented Sep 9, 2024

Thanks to your repo, I've managed to reproduce the issue, investigating the root cause of it 🕵️

@jeremynikolic
Copy link

Root cause found, further testing on the fix in progress ⏳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix incoming A fix is in review
Projects
None yet
Development

No branches or pull requests

3 participants