To reproduce:
- start with a site with no user flags (such as on initial install of Flag)
- add a view of users
- notice there is no 'user flag' relationship, because there are no user flags yet
- add a user flag
- go back to the view and add a relationship: there is still no 'user flag' relationship, even though there is a user flag now.
- clear caches
- user flag relationship is now visible
Adding or deleting a flag should therefore clear Views data caches. For bonus points, only clear them when we're adding a flag of a type that doesn't exist yet / deleting the last flag of its type.
Comment | File | Size | Author |
---|
Comments
Comment #2
zahord CreditAttribution: zahord as a volunteer and at Skilld commentedComment #3
zahord CreditAttribution: zahord as a volunteer and at Skilld commentedComment #5
zahord CreditAttribution: zahord as a volunteer and at Skilld commentedupdated
Comment #6
zahord CreditAttribution: zahord as a volunteer and at Skilld commentedComment #8
socketwench CreditAttribution: socketwench as a volunteer commentedThere is an older patch for this which contains the fixes for the Flag entity: https://www.drupal.org/project/flag/issues/2851054#comment-12412982
I'm still concerned about this line, though. Why are we clearing the views cache in a test?
Comment #9
andypostThis issue should be focused on adding tests cos I failed to write ajax tests for views relation in #2851054-12: Cannot add Flags relationship to views. Getting AJAX error
this no longer needed cos flags do clear cache on save/delete now
Comment #10
andypostcase for test still valid in IS
Comment #11
socketwench CreditAttribution: socketwench as a volunteer commentedBumping status since this is holding up other views improvements.
Comment #12
arunkumarkI have re-rolled the patch to resolve the issue with the suggestion from the comment #10
Comment #14
socketwench CreditAttribution: socketwench as a volunteer commentedThanks for the patch @arunkumark, but the postSave() and postDelete() are already part of the Flag entity.
@andypost Do we still need the views clears in the tests?
Comment #15
andypostIf was commited as I remember, here we should add a test and remove manual cleaning from otger tests
Comment #16
andypostYes, cache clear in https://cgit.drupalcode.org/flag/tree/src/Entity/Flag.php?h=8.x-4.x#n503
Comment #17
BerdirThat sounds like a normal task and not a critical bug then now? Also can't find any manual views data cache clears in test, being able to remove those would have been easy test coverage.