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

Tag field change does not trigger change state #260

Closed
josephlewisnz opened this issue Sep 18, 2023 · 7 comments
Closed

Tag field change does not trigger change state #260

josephlewisnz opened this issue Sep 18, 2023 · 7 comments

Comments

@josephlewisnz
Copy link
Contributor

josephlewisnz commented Sep 18, 2023

SS4.13
Tagfield version: "2.11.1"

TagField::create(
    'ProjectTopics',
    'Project Topics',
    ProjectTopic::get(),
    $this->ProjectTopics()
)
    ->setCanCreate(true),

When I make changes to my "TagField" it does not let the page know that there are changes. This ultimately means the admin does not know that they need to publish the page to save the tag.
And it has an impact on the "onAfterPublish" does not fire (silverstripe/silverstripe-cms#1791).
From my understanding the page thinks there is nothing to publish.

I imagine this is a result of #125

Sounds like a recent issue/PR has manage to fix this on the latest branch for SS5 #247
I will take a look to see if this can be brought back too. However if there is any work around, that would be much appreciated.

Typically this would not be an issue, however I am reliant on the "onAfterPublish" triggering for Search indexing.

PRs

@GuySartorelli
Copy link
Member

Hi,
Thanks for reporting this. Would you be willing to implement a bug fix and submit a pull request?

@josephlewisnz
Copy link
Contributor Author

josephlewisnz commented Sep 19, 2023

I've had a look comparing the branch 3 vs branch 2 and there are quite a few changes especially in the react side, so it wasn't quite as easy as I thought.

I've now done some more digging and there looks like more of an underlying issue with the fact that many_many does not trigger a page change state

I'm happy to have a crack - One thing I am not familiar or sure about is how to actually trigger the "change" state of a page - would you know the method or place that the CMS. aka I'm not actually sure what is triggered to make the buttons go from
This:
image

to this
image

@sabina-talipova sabina-talipova self-assigned this Sep 22, 2023
@josephlewisnz
Copy link
Contributor Author

josephlewisnz commented Sep 22, 2023

I've done the first cut of changes - still pending proper testing.
https://github.com/josephlewisnz/silverstripe-tagfield/tree/fix/trigger-has-changes

Not quite ready for PR.

Running into issues with the yarn build... From my guess is these must come from SS vendor files through the webpack externals - maybe this webpack is just not configured correctly?
I will try take a look at building/testing next week - however if @GuySartorelli or @sabina-talipova you know a quick fix
image

@GuySartorelli
Copy link
Member

You need to run yarn install in the silverstripe/admin repository (which means you need to install that module with --prefer-source) as well as the repo you're running yarn build in.

@sabina-talipova sabina-talipova removed their assignment Sep 22, 2023
@josephlewisnz
Copy link
Contributor Author

PR #262

@sabina-talipova
Copy link
Contributor

@josephlewisnz, Thank you for your contribution. Nice work!
Issue was fixed. Merged PR will be automatically tagged by CI actions.

@sabina-talipova sabina-talipova removed their assignment Oct 9, 2023
@josephlewisnz
Copy link
Contributor Author

Thanks for testing @sabina-talipova

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