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

fix(ui): handle React 18 batching for "Submit" button on details page. Fixes #13453 #13593

Merged
merged 7 commits into from
Oct 1, 2024

Commits on Sep 12, 2024

  1. fix(ui): Submit button grayed out on details page. Fixes argoproj#13453

    The React 18 upgrade in
    argoproj#13069 introduced a bug
    on the details page where the "Submit" button is disabled immediately on
    page load. Specifically, I believe this is happening due to batching
    changes that affect the following two `useEffect()` calls, which are
    common to all the details pages modified in this PR:
    ```
        useEffect(() => {
            (async () => {
                try {
                    const newEventSource = await services.eventSource.get(name, namespace);
                    setEventSource(newEventSource);
                    setEdited(false); // set back to false
                    setError(null);
                } catch (err) {
                    setError(err);
                }
            })();
        }, [name, namespace]);
    
        useEffect(() => setEdited(true), [eventSource]);
    ```
    
    The first runs immediately and invokes `setEventSource(newEventSource)`,
    which causes the second `useEffect()` call to be fired, since the
    `eventSource` dependency has changed. Since both are invoking
    `setEdited()`, this is basically a race condition, since the state of
    `edited` is going to depend on whether these calls are batched together
    are fired separately.
    
    This PR fixes that by removing the second `useEffect()` call, which
    eliminates the race condition. Instead, we only call `setEdited(true)`
    when the editor is modified.
    
    Signed-off-by: Mason Malone <[email protected]>
    MasonM committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    fe7d6be View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2024

  1. fix(ui): stylistic fixes

    Signed-off-by: Mason Malone <[email protected]>
    MasonM committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    2747d17 View commit details
    Browse the repository at this point in the history
  2. fix(ui): cache using useMemo() and fix sensor-details.tsx

    Signed-off-by: Mason Malone <[email protected]>
    MasonM committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    1ef4958 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2024

  1. Merge branch 'main' into fix-13453

    Signed-off-by: Mason Malone <[email protected]>
    MasonM committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    c249458 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2024

  1. refactor(ui): Extract to hook and delete deep Object comparison

    Signed-off-by: Mason Malone <[email protected]>
    MasonM committed Sep 28, 2024
    Configuration menu
    Copy the full SHA
    24c0206 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'main' into fix-13453

    Signed-off-by: Mason Malone <[email protected]>
    MasonM committed Sep 28, 2024
    Configuration menu
    Copy the full SHA
    a54bbd3 View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2024

  1. refactor: rename to useEditableObject and update comments

    Signed-off-by: Mason Malone <[email protected]>
    MasonM committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    cf9a3f3 View commit details
    Browse the repository at this point in the history