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

Multi-reference extension not syncing referenced entry changes #403

Open
knupska opened this issue Sep 20, 2020 · 9 comments
Open

Multi-reference extension not syncing referenced entry changes #403

knupska opened this issue Sep 20, 2020 · 9 comments
Labels
enhancement New feature or request stale Used to mark when there was no activity for a set period of time

Comments

@knupska
Copy link

knupska commented Sep 20, 2020

Background
I'm attempting to create an enhanced multi-reference editor, styled and operating as per the default Contentful (Forma 36) functionality, but from which I can have entry fields be directly editable on the sortable card.

This is to cut down on the multiple steps it currently takes a content author to open a referenced entry, check a field value, change the field value, publish and then return.

By leveraging the renderCustomCard property on the MultipleEntryReferenceEditor to return a reimplemented WrappedEntryCard and having that import a custom EntryCard based on the source, I have almost gotten this to work.

Unfortunately, changes that I make to the referenced entries using sdk.space.updateEntry are not syncing back into the MultipleEntryReferenceEditor.

Issue
It appears that field extensions are not provided access to sdk.space.onEntityChanged, so the EntityStore used by the ReferenceEditor does not observe changes made to the referenced entries.

The default Entry links list appearance provided by Contentful does not experience this.

I have not been able to find a viable workaround to having the referenced entries update after either my own or external changes.

Replication
The lack of syncing changes from referenced entries into the multi-reference extension can be seen in the extensions/multiple-references-extension example provided in this repository.

  • Install the example as per the instructions
  • Apply it to an appropriate field in your Content model
  • Create demo content if necessary
  • Open two browser windows
  • Access and edit a referenced entry in the second window

The status and values shown on the card in the first window will quickly become out of sync.

multi-reference-no-sync

@knupska
Copy link
Author

knupska commented Oct 6, 2020

As there has been no activity on this issue for several weeks, I will attempt to clarify.

When the MultipleEntryReferenceEditor is used as an extension, any changes made to the referenced entries are not kept in sync regardless of how those changes are made:

  • By any of the sdk.space methods like updateEntry or publishEntry
  • By another tab, window, or browser
  • By another content author

This is not caused by our extension, code or edits.
It can be seen directly in the multiple-references-extension example provided by Contentful.

Under the most basic usage where an entry is edited in the same tab, the changes sync once the edit pane is closed because the EntityStore has a fallback to listen to the slide in navigation. This isn't useful when the changes could be originating from any number of places as outlined above.

This issue is a roadblock for the following extension created to address client complaints that the default Contentful UI isn't streamlined enough.

on-card-stock

@djagya
Copy link
Contributor

djagya commented Oct 13, 2020

Hi @knupska, thanks a lot for the detailed report, I appreciate the time you spent on investigation. And sorry for the delayed answer.

You're right, sdk.space.onEntityChanged is only accessible within the web app and can not be accessed from the public widget SDK. As you correctly said, exposing this method would allow reference cards to be updated whenever an entry is changed elsewhere.

I will ask the team managing https://github.com/contentful/ui-extensions-sdk if we can expose it.

@djagya
Copy link
Contributor

djagya commented Oct 13, 2020

There's nothing stopping us from adding it to the public SDK, but first we want to wait for contentful/ui-extensions-sdk#345 to be finished. I added a ticket to our backlog and will keep you updated.

@djagya djagya added the enhancement New feature or request label Oct 13, 2020
@knupska
Copy link
Author

knupska commented Oct 16, 2020

Thanks for chasing it up @djagya.

Apologies for reporting it here too, I hadn't noticed those methods were actually being exposed by the ui-extensions-sdk package.

@github-actions
Copy link

Marking issue as stale since there was no activity for 30 days

@github-actions github-actions bot added the stale Used to mark when there was no activity for a set period of time label Sep 21, 2022
@knupska
Copy link
Author

knupska commented Jul 27, 2023

It's been some time (almost 3 years), can anyone at Contentful advise if this was ever added to the public widget SDK, or if it has otherwise changed in a way where it is now possible to achieve via an extension?

@github-actions github-actions bot removed the stale Used to mark when there was no activity for a set period of time label Jul 27, 2023
@github-actions
Copy link

Marking issue as stale since there was no activity for 30 days

@github-actions github-actions bot added the stale Used to mark when there was no activity for a set period of time label Aug 26, 2023
@th1nkgr33n
Copy link

We encounter this behaviour in the latest app framework as well.
Using the renderCustomCard-prop will lead to not updated List if you add or edited an entry.

@github-actions github-actions bot removed the stale Used to mark when there was no activity for a set period of time label Apr 19, 2024
Copy link

Marking issue as stale since there was no activity for 30 days

@github-actions github-actions bot added the stale Used to mark when there was no activity for a set period of time label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Used to mark when there was no activity for a set period of time
Projects
None yet
Development

No branches or pull requests

3 participants