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

String widgets (text and rich-text) won't allow edits to be saved once the value has become null #11658

Open
SDScandrettKint opened this issue Nov 27, 2024 · 8 comments
Assignees

Comments

@SDScandrettKint
Copy link
Member

SDScandrettKint commented Nov 27, 2024

Tested in 7.4.x, 7.5.x & 7.6.x

The string widgets (text and rich-text) won't allow edits to be saved once the value has become null. Video demonstration is attached below. It looks like once the node value has been converted to null, the dirty state isn't prompted and the inputs aren't retained.

Steps to reproduce:

  1. In a model with a string node, enter string data and save the node.
  2. Remove the string and save again.
  3. Try add string data back - this will not prompt a dirty state and the data can't be added.

Refreshing the page gets it to work again.

Video demonstration for both text and rich text widgets:

String_issue_7.6.mp4

This also happens when a node (e.g. concept, date etc) is saved in a card that consists of lots of nodes (string included) where the string node is left blank.

string_edits.mp4
@chiatt chiatt added this to pipeline Nov 27, 2024
@SDScandrettKint
Copy link
Member Author

Unsure if related, but once a save has been made to another node (e.g. concept) and text is entered into the rich text or regular text widgets the values disappear once moving away and back to the card, but the data is persisted in the node preview on the left side

string_persisting_issue.mp4

@SDScandrettKint SDScandrettKint changed the title Empty string datatype/widget won't accept edits once a save has already been made Empty string datatype/widget won't accept edits once a save has already been made, or persist the new value Nov 28, 2024
@SDScandrettKint

This comment was marked as resolved.

@SDScandrettKint SDScandrettKint changed the title Empty string datatype/widget won't accept edits once a save has already been made, or persist the new value Widgets won't accept edits once a save has already been made, or persist the new values Nov 28, 2024
@SDScandrettKint SDScandrettKint changed the title Widgets won't accept edits once a save has already been made, or persist the new values String (and rich-text) widgets won't accept edits once a save has already been made, or persist the new values Dec 1, 2024
@SDScandrettKint SDScandrettKint changed the title String (and rich-text) widgets won't accept edits once a save has already been made, or persist the new values String widgets (text and rich-text) won't allow edits to be saved once the value has become null Dec 20, 2024
@SDScandrettKint SDScandrettKint self-assigned this Dec 20, 2024
@SDScandrettKint
Copy link
Member Author

Note: I've just tested this in 7.4 and the issue is still present.

@SDScandrettKint
Copy link
Member Author

This issue feels connected to this issue #10796.
Both datatypes (string and URL) have a JSON structure, and setting them to null is causing the same UI response.

@bferguso
Copy link
Contributor

bferguso commented Jan 10, 2025

I'm also seeing some strange behaviour that seems related. When entering data in a card that has a Rich Text widget, trying to save the card without filling out the Rich Text field causes a validation error. When looking at the data in the StringDataType.validate() function, the selected language value (for us 'en') has a value of {'direction': 'ltr'} (note the missing value key.

Note that in the instance below, only the last Rich Text field is affected. If a value is put into the second Text field but not the first, it saves properly.

Looking at the data sent from the browser, in our case the JSON representing that field is missing the "value" key for the selected language.

Screen.Recording.2025-01-10.at.13.59.38.mov

@SDScandrettKint
Copy link
Member Author

I'm also seeing some strange behaviour that seems related. When entering data in a card that has a Rich Text widget, trying to save the card without filling out the Rich Text field causes a validation error. When looking at the data in the StringDataType.validate() function, the selected language value (for us 'en') has a value of {'direction': 'ltr'} (note the missing value key.

Note that in the instance below, only the last Rich Text field is affected. If a value is put into the second Text field but not the first, it saves properly.

Looking at the data sent from the browser, in our case the JSON representing that field is missing the "value" key for the selected language.
Screen.Recording.2025-01-10.at.13.59.38.mov

@bferguso I have also experienced this issue in the past (most notably on 7.5.x) with both text and rich-text widgets, however, I don't see it anymore on 7.6.x and am unable to replicate the issue in your video. Saving an empty string saves the value as null in the database for me.

Are you using 7.6.x? I'm guessing so, from looking at the bottom left but I just wanted to check.

@bferguso
Copy link
Contributor

@SDScandrettKint - Yes, using 7.6.4.

The strange thing is that the rest of the language codes are correct, it's just the active one that is missing the key. When looking at the cards_x_nodes_x_widgets table the defaultConfig for those widgets were incorrect, but even after updating them I'm still having the issue. Trying to track down why that value is missing, but fully into the weeds at this point. The "cardwidgets" value held in parsedResourceEditorData in resource-edito-data.js is missing that language code value, but not sure why at this point.

@bferguso
Copy link
Contributor

bferguso commented Jan 13, 2025

OK - I see what the issue is. Because at some point the defaultValue was mangled in the cards_x_nodes_x_widgets, the value in the serialized_graph column of the published_graphs table was incorrect. On line 294 of the resource.py it gets the cardwidgets from the serialized graph if it exists, otherwise it pulls it from the table. Looking for a way to update the serialized version that doesn't require an Unpublish/Publish in the Graph Designer UI.

Looking at the JSON produced by exporting the Graph, it appears that the serialized version of the graph had a bunch of invalid defaulValue values including:

""
{"en": {"value": null, "direction": "ltr"}}
{"en": {"direction": "ltr"}}

We have only ever used the Graph Designer UI Manage -> Export Model function to generate this file so I'm guessing there may have been (or still is) an issue somewher in the Graph Designer that is causing this data to be incorrectly generated.

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

No branches or pull requests

2 participants