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

Manually added json node doesn't have designer id and cannot edit lg text #1776

Closed
2 of 7 tasks
yeze322 opened this issue Dec 16, 2019 · 3 comments
Closed
2 of 7 tasks
Labels
Type: Bug Something isn't working

Comments

@yeze322
Copy link
Contributor

yeze322 commented Dec 16, 2019

Describe the bug

If manually create an Action node in plain text editor without $designer field, composer cannot load it correctly.

  • Visual Editor can show lg text, Form Editor can show lg text
  • Form Editor cannot edit lg text

image
image

Root cause is the manually created node doesn't have $designer id. It's broke by some recent updates.

Version

What version of the Composer are you using? Paste the build SHA found on the about page (/about).

Browser

What browser are you using?

  • Chrome
  • Safari
  • Firefox
  • Edge

OS

What operating system are you using?

  • macOS
  • Windows
  • Ubuntu

To Reproduce

Steps to reproduce the behavior:

  1. Open a dialog file with your text editor.
  2. Insert a "SendActivity" Action at somewhere
  3. Load this bot in Composer
  4. Try to edit lg text

Expected behavior

Give a clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots/gif/video to help explain your problem.

Additional context

We used to rely on the 'DesignerField' component in FormEditor to make sure every node has a $designer id at initial rendering. However, seems this component was alraedy retired.

Now, not all nodes have a $designer id and it breaks the LgWidget which relies on node id to write lg content back to lg file.

@yeze322 yeze322 added the Needs-triage A new issue that require triage label Dec 16, 2019
@cwhitten cwhitten removed the Needs-triage A new issue that require triage label Dec 17, 2019
@cwhitten
Copy link
Member

Instead of bringing back old behavior that could frustrate developers let's think about a way to not mutate json files out from under users. Tabling for now to discuss options.

@cwhitten cwhitten added the Type: Bug Something isn't working label Dec 17, 2019
@boydc2014
Copy link
Contributor

Previously we have the logic to auto-create template based on raw text, and replace the original text with a ref to the newly created template. The benefits for that is our LgEditorField can only assume all lgField is a ref to a template, not some random raw data.

To me, i'm not too concerned about mutating json for user as long as we have the consensus from user. So i'm proposing the option that either

  1. Detecting the pattern and do the conversion at the beginning or
  2. Do the conversion lazily when user view or try to update the lgField.

Both 1 & 2 are OK, and I prefer 1 because if we do the mutate anyhow, perhaps do it lazily is less cleaner than doing it at the begging.

@yeze322
Copy link
Contributor Author

yeze322 commented Jun 2, 2020

Now we force every action has a $designer id, this issue is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants