You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The taxonomy panel post_tag do not refresh with programmatical update #15147
@Mamaduka - I'm currently using the approach by @harisrozak above. This updated the UI and the Redux store, yet if I save the Post (which I currently have to enable through updating a faux private metafield, otherwise the Update button doesn't enable), the tags / categories aren't saved, the UI reloads with the tags / categories cleared of any selection applied.
Is there a mechanism to mark tags / categories "dirty" that I've missed maybe?
@edufolios-matt Yes, I don't know either why it's not working when it using the selected_term_ids, maybe it's not an array, or I did wrong with the adding the term_id into it.
Activity
herewithme commentedon Apr 24, 2019
The behavior is OK, if the term appeared within autocompletion (even if not clicked), following the AJAX call on the REST API!
Mamaduka commentedon Jun 17, 2021
I'm able to reproduce the issue.
The
FlatTermSelectorfetches term objects oncomponentDidMount. When post tags are updated terms programmatically new term object isn't fetched.If you close/open the "Tags" panel new term should be visible since component remounts.
lear2012 commentedon Jun 18, 2021
I experienced the same issue.
wp.data.dispatch('core/editor').editPost({tags: [3]}) invoked in component class, it doesn't work as expected.
harisrozak commentedon Nov 17, 2021
Nice catch!, so for now, we can programmatically toggle the "Tags" panel to achieve the right behavior, maybe something like this:
Mamaduka commentedon Nov 18, 2021
Sorry forgot to post an update here. The issue should be fixed via #33459 and available in Gutenberg 11.9.
edufolios-matt commentedon Dec 8, 2021
@Mamaduka - I'm currently using the approach by @harisrozak above. This updated the UI and the Redux store, yet if I save the Post (which I currently have to enable through updating a faux private metafield, otherwise the Update button doesn't enable), the tags / categories aren't saved, the UI reloads with the tags / categories cleared of any selection applied.
Is there a mechanism to mark tags / categories "dirty" that I've missed maybe?
harisrozak commentedon Dec 13, 2021
@edufolios-matt Just in case you haven't find the solution, you can try to create a new array to store the term ids instead of using the
selected_term_ids. Please check my gist here: https://gist.github.com/harisrozak/64764a84cd4b3bd7845084572850ba78edufolios-matt commentedon Dec 13, 2021
@harisrozak thanks for that. Are you thinking that is so the array will be seen as totally new data and saved differently?
harisrozak commentedon Dec 13, 2021
@edufolios-matt Yes, I don't know either why it's not working when it using the
selected_term_ids, maybe it's not an array, or I did wrong with the adding the term_id into it.edufolios-matt commentedon Dec 13, 2021
@harisrozak - you legend!! That worked!!