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

FIX Update LinkField if Elemental version status was updated #268

Conversation

sabina-talipova
Copy link
Contributor

Description

This fix updates the component if the elemental state has been updated.

Manual testing steps

  • I create a new Elemental block with LinkField;
  • I create a new Link;
  • I see "Draft" badge in LinkField;
  • I publish the block (not a Page);
  • I still see "Draft" badge in LinkField;
  • I refresh the Page and then a badge disappears.

Issues

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

@sabina-talipova
Copy link
Contributor Author

The failed test requires silverstripe/silverstripe-elemental#1160

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fundamentally the wrong approach. This is creating a coupling between linkfield and elemental which are two optional modules.

The solution should be something more along the lines of:

  1. elemental publishes/unpublishes the link
  2. elemental forces a formSchema refetch (/admin/elemental-area/schema/elementForm/1) - I'm not sure the best way to go about this since it's tied closely to FormBuilder/redux-form
  3. (hopefully) as part of that there's a call made to refetch linkfield data (/admin/linkfield/data?itemIDs[]={ids}) which contains the updated versioned status for the link

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

Successfully merging this pull request may close these issues.

2 participants