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

Lock the field data name during editing the title #82

Closed
mskapusuz opened this issue Nov 26, 2022 · 10 comments · Fixed by #362
Closed

Lock the field data name during editing the title #82

mskapusuz opened this issue Nov 26, 2022 · 10 comments · Fixed by #362
Assignees
Labels
enhancement Request to improve or optimize an existing feature or functionality in the project released Indicate that an issue has been resolved and released in a particular version of the product.
Milestone

Comments

@mskapusuz
Copy link
Contributor

mskapusuz commented Nov 26, 2022

Currently, when you try to edit a field title; the dataname is changed as automatically. That's good for the fresh fields, but it's not good for editing the fields.

That dataname is saved in order item meta, therefore if the dataname of the field has been changed, it affects lots of places:

  • PPOM field titles are not human-readable in older orders (admin, my account, etc.) because human readable field title is matched with dataname in order item meta and field data name of the PPOM field
  • If there is a customization (let's say a third-party integration that binds to the dataname; that will be broken.)
  • If there is a conditional field mechanism setup that depends on the field whose name is changed; that will be broken

Screen Shot 2022-11-27 at 01 57 59
https://vertis.d.pr/i/pIi5TB


Proposal

When we are in the edit screen, we should disconnect the data field from the title, when the title is edited, we should not change the data field and user will need to change it manually.

@mskapusuz mskapusuz added the enhancement Request to improve or optimize an existing feature or functionality in the project label Nov 26, 2022
@selul selul added this to the v33.0.0 milestone Sep 3, 2024
@girishpanchal30
Copy link
Contributor

I've reviewed this ticket and fixed it here - #362

@girishpanchal30 girishpanchal30 linked a pull request Sep 10, 2024 that will close this issue
6 tasks
@selul
Copy link
Contributor

selul commented Sep 10, 2024

@girishpanchal30 seems like you are making that readonly, I want to avoid those to sync when there is a value already saved, people can still change it if they want, but only if they change that field and not the title one.

@girishpanchal30
Copy link
Contributor

@selul I attempted to avoid syncing when saving data, but it isn't possible because data_name is stored in a serialized format within the_meta.

I also tried retrieving the existing the_meta and replacing the data_name, but this approach seems to cause an issue when reordering fields.

So I've just made it read-only and skipped the field update while editing the title.

@selul
Copy link
Contributor

selul commented Sep 10, 2024

@girishpanchal30 I'm not sure if I get the issue, this looks like a frontend JS issue and has nothing to do with changing how we store the data or PHP side?

The logic is simple from my end, when editing an existing field, we can disable the js that changes the data name when I edit the title?

Am I missing something?

@girishpanchal30
Copy link
Contributor

'm not sure if I get the issue, this looks like a frontend JS issue and has nothing to do with changing how we store the data or PHP side?

On the PHP side, data is saved in a serialized format along with the POST data.

The logic is simple from my end, when editing an existing field, we can disable the js that changes the data name when I edit the title?

I've disabled it when the field is in read-only mode.

Here - b99a862#diff-44d139997568d1760113b5cad31792552415b4df27e795b0dfcbc21f36f4f024R994

@selul
Copy link
Contributor

selul commented Sep 10, 2024

@girishpanchal30 instead of making it readonly, we can allow editing it when the user is directly editing that. RIght now there is no way to change that name, which he was able to do before.

@girishpanchal30
Copy link
Contributor

@selul I've removed the readonly attribute and disabled the auto data name update. Please check with the latest commit.

@selul
Copy link
Contributor

selul commented Sep 10, 2024

@girishpanchal30 now when I add a new field, to an existing group, when writing the title the data is no longer being added automatically as before.

@girishpanchal30
Copy link
Contributor

@selul Fixed it with the latest commit.

@selul selul mentioned this issue Sep 26, 2024
@pirate-bot
Copy link
Contributor

🎉 This issue has been resolved in version 33.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Sep 27, 2024
@selul selul closed this as completed Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request to improve or optimize an existing feature or functionality in the project released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants