ads-ui icon indicating copy to clipboard operation
ads-ui copied to clipboard

Make sure there are no hanging promises

Open IanKrieger opened this issue 1 year ago • 12 comments

enable the below eslint config and fix any errors:

    "@typescript-eslint/no-floating-promises": "error",
    "@typescript-eslint/no-misused-promises": "error",

IanKrieger avatar Jan 31 '24 20:01 IanKrieger

@IanKrieger can I work on this issue?

shubrautt avatar Feb 01 '24 20:02 shubrautt

Yes you can, @shubrautt

IanKrieger avatar Feb 01 '24 20:02 IanKrieger

image @IanKrieger should I add void keyword or need to handle the promise?

shubrautt avatar Feb 01 '24 21:02 shubrautt

I think in cases where we are setting a form value, we should await them, making the onClick async: onClick{async () => ...}

IanKrieger avatar Feb 01 '24 21:02 IanKrieger

I think we need to set checksVoidReturn to be false, to avoid this error @typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }]

shubrautt avatar Feb 03 '24 08:02 shubrautt

I don't think we need that rule, but If you could provide an example of a line in the codebase that is failing because this check does not exist, we can go from there and I can give some direction on how to handle that.

IanKrieger avatar Feb 05 '24 14:02 IanKrieger

This is the file where I'm getting error. image

shubrautt avatar Feb 05 '24 15:02 shubrautt

Same error also exist on other files also

shubrautt avatar Feb 05 '24 15:02 shubrautt

Hmm, well since I do wish for the value updates to propagate, and I do not like the workarounds I've seen, I am fine with { "checksVoidReturn": false }

Thank you for asking

IanKrieger avatar Feb 05 '24 20:02 IanKrieger

image

what should I use while solving no-floating-promises errors, async/await or then/catch?

shubrautt avatar Feb 08 '24 21:02 shubrautt

I think void in this scenario is ok, as any actions we want to take should be in the hook definition.

IanKrieger avatar Feb 09 '24 15:02 IanKrieger

#1049, @IanKrieger I have pushed the code, How can I figure out where things need to be handled?.

shubrautt avatar Feb 13 '24 21:02 shubrautt

This issue is stale because it has been open for over a year with no activity. Remove stale label or add a comment to avoid this being closed in a weeks time.

github-actions[bot] avatar Feb 13 '25 03:02 github-actions[bot]

This issue was closed because it has been inactive for a week since being marked as stale.

github-actions[bot] avatar Feb 20 '25 03:02 github-actions[bot]