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

[Bug, Web, UI] Double New Data Record on Double-Click #1292

Open
AronPerez opened this issue Feb 5, 2025 · 4 comments
Open

[Bug, Web, UI] Double New Data Record on Double-Click #1292

AronPerez opened this issue Feb 5, 2025 · 4 comments
Labels
Component: Web UI Relates to web appp user interface Type: Bug Something isn't working

Comments

@AronPerez
Copy link
Collaborator

AronPerez commented Feb 5, 2025

Description

This bug occurs when the Start button on creating a new data record is left-clicked quickly in succession before the modal closes. This leads to 2 data records being created.

Steps to Replicate

  1. Ensure your project is configured correctly (repo etc)
  2. Follow USE_CASE - Transfer Data - New Data Record if access is available, otherwise:
  3. Right-click on the dashboard
  4. Hover over New
  5. Left-click Data Record
  6. Fill out Title
  7. Double-left-click the Start button
  8. 2 data records should be created

Artifacts

Bug Replication

Screen.Recording.2025-02-05.at.4.20.54.PM.mov

Bug Console Log

Image

Bug Error Stack Trace


Uncaught TypeError: Cannot read properties of undefined (reading 'trim') 
at callback (dlg data new edit.js:268:50) api.js:204:19 
at Object. success (api.js:44:17) at Tire query. 5.3000:44) 
at Object.fireWith [as resolveWithl (jguery_js:3729:29) 
done (jquery-j.s:9832:30) | locate new Cops.4oo

@AronPerez AronPerez added Component: Web UI Relates to web appp user interface Type: Bug Something isn't working labels Feb 5, 2025
@JoshuaSBrown
Copy link
Collaborator

This looks like an async error.

@JoshuaSBrown
Copy link
Collaborator

Dylan, and I saw a similar problem when changing this before.

@JoshuaSBrown
Copy link
Collaborator

JoshuaSBrown commented Feb 5, 2025

In C++ you could use RAII to solve this but I don't think that works in JavaScript. Can you create a flag, that indicates that the button has already been pressed so that it won't make the call twice?

i.e.

var isSubmitting = false;

:
 function callback(ok, reply) {
        isSubmitting = false;
        if (ok) {
            if ((a_data && !a_data.external) || (!a_data && !extern.prop("checked"))) {
                // Start transfer if source changed
                var tmp
:
// The following are in the options var
:
:
     buttons: [
            {
                text: "Cancel",
                click: function () {
                    $(this).dialog("close");
                },
            },
            {
                id: "do_it",
                text: DLG_DATA_BTN_LABEL[a_mode],
                click: function () {
                    if (isSubmitting) return;
                    isSubmitting = true;

:
:
    close: function (ev, ui) {
            isSubmitting = false;
            jsoned.destroy();
            $(this).dialog("destroy").remove();
        },

@JoshuaSBrown
Copy link
Collaborator

I don't think this error you found is related to dual entries.

Uncaught TypeError: Cannot read properties of undefined (reading 'trim') 
at callback (dlg data new edit.js:268:50) api.js:204:19 
at Object. success (api.js:44:17) at Tire query. 5.3000:44) 
at Object.fireWith [as resolveWithl (jguery_js:3729:29) 
done (jquery-j.s:9832:30) | locate new Cops.4oo

This is simply because there is no text in the source_file entry in the form. At least that is my first impression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Web UI Relates to web appp user interface Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants