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

Ctrl + Z combination changes the code in editor but not the value of the Catalog field #74

Closed
Untouchamp opened this issue Sep 30, 2022 · 4 comments
Assignees
Labels
bug Something isn't working regression A bug that was not present in the original editor

Comments

@Untouchamp
Copy link
Collaborator

Untouchamp commented Sep 30, 2022

Precondition:
"Sample A" - current example.
"Sample B" - an example we will be switching to.
User is on the main page. Example "Sample A" is opened in editor.

Steps to reproduce:

  1. Type anything in editor.
  2. Click on the dropdown with examples.
  3. Pick any other example.
  4. The example in the editor switched to the selected one (Sample B is our current example now).
  5. Press Ctrl + Z in the editor

Expected Result:
Nothing happens. (According to the prod page)
Acutal Result:
Previous example "Sample A" appears, but selected value in the Catalog dropdown field stays the same.

@Untouchamp Untouchamp added bug Something isn't working regression A bug that was not present in the original editor labels Sep 30, 2022
@alexeyinkin
Copy link
Contributor

Test branch was: pg_23415_akvelon-editor_from-23304

@nausharipov
Copy link
Collaborator

The reason is that input history is saved after setting controller text:

class Experiment extends StatelessWidget {
  const Experiment({super.key});

  @override
  Widget build(BuildContext context) {
    final TextEditingController controller = TextEditingController();
    return MaterialApp(
      home: Scaffold(
        body: Column(
          children: [
            // 1. Type anything in the text field
            // 2. Press the button to set text
            // 3. Press ctr+z
            // Previously typed text is visible.
            TextField(
              controller: controller,
            ),
            ElevatedButton(
              onPressed: () {
                controller.text = 'some text';
              },
              child: const Text('Set some text'),
            ),
          ],
        ),
      ),
    );
  }
}

I haven't found a method to clear input history of TextField. Should I open an issue or ask on StackOverflow?

@alexeyinkin
Copy link
Contributor

I think this can be solved by adding key to CodeField which will re-create the editor state when changing an example or SDK. So no need for posting there.

@alexeyinkin
Copy link
Contributor

Fixed in apache/beam#23900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression A bug that was not present in the original editor
Projects
None yet
Development

No branches or pull requests

3 participants