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

Put cloneData function for slate block, in order to change the uuids of fragments #5518

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

dobri1408
Copy link
Contributor

No description provided.

Copy link

netlify bot commented Dec 12, 2023

Deploy Preview for volto canceled.

Name Link
🔨 Latest commit d62d505
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/65e1906a7ceefc000842a1de

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

@dobri1408 Could you please add a description of the problem you are solving to the PR description? Without it, it is hard to review.

@dobri1408
Copy link
Contributor Author

Slate lets you put on some of its words(fragments) uuids, that can be used for add-ons, for example for volto-slate-footnotes from EEA. But, if you use the copy and paste of Volto from the sidebar, it will copy the fragments with the same uuids, and this is not ok. @davisagli

@dobri1408 dobri1408 requested a review from davisagli December 13, 2023 06:17
@dobri1408
Copy link
Contributor Author

@stevepiercy yes indeed

...(data?.value || []).map((c) => {
return {
...c,
children: (c?.children || []).map((childrenData) => {
Copy link
Member

Choose a reason for hiding this comment

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

Won't this add children to nodes that should not have it, like text nodes?

I would really like to see a test for this feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is true, I will modify, and add tests

children: (c?.children || []).map((childrenData) => {
return {
...childrenData,
data: { ...childrenData.data, uid: nanoid(5) },
Copy link
Member

Choose a reason for hiding this comment

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

This will add a uid even if there wasn't one there before; is that what we want?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that all children have uid by default

Copy link
Member

Choose a reason for hiding this comment

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

No, I don't think so. I have not seen it before.

packages/volto-slate/news/5518.bugfix Outdated Show resolved Hide resolved
Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

I approve docs. Code needs review and approval from a core contributor.

@dobri1408
Copy link
Contributor Author

@davisagli what do you think about this way?

@dobri1408 dobri1408 requested a review from davisagli December 13, 2023 09:08
Copy link

netlify bot commented Dec 16, 2023

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit d62d505
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/65e1906a31d3000008d72027

@dobri1408
Copy link
Contributor Author

@davisagli

@ichim-david
Copy link
Member

@tiberiuichim maybe you can also give you input on this change.
@davisagli @sneridagh are there other concerns that we need to address in order to get this pull request merged?

@tiberiuichim
Copy link
Contributor

It's missing a test. This thing would be merged a lot faster if it proved that it did what it claims to do.

@davisagli
Copy link
Member

Yes, please add tests.

@ichim-david
Copy link
Member

Awesome, were getting somewhere :) If the user knows what he needs todo then he will do it but I would like for us to avoid letting pull requests stay for months until they get so old that it takes a considerable effort to bring up to date.

I will try to be more helpful as well to push for my colleagues to ask quicker for feedback so that we can add quickly what is necessary to get a change in a mergeable state and finally merged.

Thanks to you both for the feedback, we will see about getting those tests added.

@davisagli
Copy link
Member

@ichim-david For what it's worth, I asked for tests in December, and @dobri1408 said he would add them, so I thought the next step was clear.

I agree that it would be good if we can find a way to respond to pull requests faster, but I'm not sure what to do about the current backlog. Realistically I only have time and energy to do a full review of one or two per day, and not every day.

@ichim-david
Copy link
Member

@ichim-david For what it's worth, I asked for tests in December, and @dobri1408 said he would add them, so I thought the next step was clear.

I agree that it would be good if we can find a way to respond to pull requests faster, but I'm not sure what to do about the current backlog. Realistically I only have time and energy to do a full review of one or two per day, and not every day.

@davisagli I thought the test was already written due to the last comment from @dobri1408 #5518 (comment) and due to @avoinea approving the pull request as well.

If I can make a small personal request, when asking for further todo's before merging, do it in a dedicated comment, that small comment was in a thread and it seemed like something solved already, but when seeing a test requirement comment you can see if there was any reply given on that individual comment if done or not.

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

@dobri1408 (+ /cc @ichim-david @tiberiuichim)

I'm looking at this again and have some questions:

  1. What's the goal for how this interacts with the volto-slate-footnote addon? Is the cloned block supposed to refer to the same footnote, or a new copy of the footnote, or no footnote? If no footnote, then I think it would make more sense to remove the uid instead of generate a new one that is not used for anything?
  2. I'm having a doubt about whether volto should try to anticipate everything that might need to happen to adjust a cloned block. Maybe it should just provide a setting that addons can use to register their own cleanup function.

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.

6 participants