[refactor] remove 6 floating-promise ignores (#5985)
* Remove trivial floating promise in authMachine * Add catch statement so LSP promise is considered non-floating * Remove trivial float in AllSettingsFields * Add error reporting for ensureWasmInit * Remove pointless floating promise in Modeling * Add comment and reportRejection to floating promise in "set selection" * Read comment, put back await that should be there * Fix dumb imports rebase botch * Missed an import --------- Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
		@ -445,10 +445,15 @@ export const ModelingMachineProvider = ({
 | 
			
		||||
                  },
 | 
			
		||||
                })
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              // If there are engine commands that need sent off, send them
 | 
			
		||||
              // TODO: This should be handled outside of an action as its own
 | 
			
		||||
              // actor, so that the system state is more controlled.
 | 
			
		||||
              engineEvents &&
 | 
			
		||||
                engineEvents.forEach((event) => {
 | 
			
		||||
                  // eslint-disable-next-line @typescript-eslint/no-floating-promises
 | 
			
		||||
                  engineCommandManager.sendSceneCommand(event)
 | 
			
		||||
                  engineCommandManager
 | 
			
		||||
                    .sendSceneCommand(event)
 | 
			
		||||
                    .catch(reportRejection)
 | 
			
		||||
                })
 | 
			
		||||
              updateSceneObjectColors()
 | 
			
		||||
 | 
			
		||||
@ -1566,9 +1571,7 @@ export const ModelingMachineProvider = ({
 | 
			
		||||
              data
 | 
			
		||||
            )
 | 
			
		||||
            if (err(result)) return reject(result)
 | 
			
		||||
 | 
			
		||||
            // eslint-disable-next-line @typescript-eslint/no-floating-promises
 | 
			
		||||
            codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
 | 
			
		||||
            await codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
 | 
			
		||||
 | 
			
		||||
            return result
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
@ -96,8 +96,7 @@ export const AllSettingsFields = forwardRef(
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      // eslint-disable-next-line @typescript-eslint/no-floating-promises
 | 
			
		||||
      navigateToOnboardingStart()
 | 
			
		||||
      navigateToOnboardingStart().catch(reportRejection)
 | 
			
		||||
    }, [
 | 
			
		||||
      isFileSettings,
 | 
			
		||||
      navigate,
 | 
			
		||||
 | 
			
		||||
@ -102,11 +102,14 @@ onmessage = function (event: MessageEvent) {
 | 
			
		||||
      intoServer.enqueue(data)
 | 
			
		||||
      const json: jsrpc.JSONRPCRequest = Codec.decode(data)
 | 
			
		||||
      if (null != json.id) {
 | 
			
		||||
        // eslint-disable-next-line @typescript-eslint/no-floating-promises, @typescript-eslint/no-non-null-assertion
 | 
			
		||||
        fromServer.responses.get(json.id)!.then((response) => {
 | 
			
		||||
          const encoded = Codec.encode(response as jsrpc.JSONRPCResponse)
 | 
			
		||||
          postMessage(encoded)
 | 
			
		||||
        })
 | 
			
		||||
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
 | 
			
		||||
        fromServer.responses
 | 
			
		||||
          .get(json.id)!
 | 
			
		||||
          .then((response) => {
 | 
			
		||||
            const encoded = Codec.encode(response as jsrpc.JSONRPCResponse)
 | 
			
		||||
            postMessage(encoded)
 | 
			
		||||
          })
 | 
			
		||||
          .catch(reportRejection)
 | 
			
		||||
      }
 | 
			
		||||
      break
 | 
			
		||||
    default:
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ import {
 | 
			
		||||
import type ModelingAppFile from '@src/lib/modelingAppFile'
 | 
			
		||||
import type { DefaultPlaneStr } from '@src/lib/planes'
 | 
			
		||||
import { defaultPlaneStrToKey } from '@src/lib/planes'
 | 
			
		||||
import { err } from '@src/lib/trap'
 | 
			
		||||
import { err, reportRejection } from '@src/lib/trap'
 | 
			
		||||
import type { DeepPartial } from '@src/lib/types'
 | 
			
		||||
import type { ModuleType } from '@src/lib/wasm_lib_wrapper'
 | 
			
		||||
import { getModule } from '@src/lib/wasm_lib_wrapper'
 | 
			
		||||
@ -48,10 +48,11 @@ export default class RustContext {
 | 
			
		||||
  constructor(engineCommandManager: EngineCommandManager) {
 | 
			
		||||
    this.engineCommandManager = engineCommandManager
 | 
			
		||||
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-floating-promises
 | 
			
		||||
    this.ensureWasmInit().then(async () => {
 | 
			
		||||
      this.ctxInstance = await this.create()
 | 
			
		||||
    })
 | 
			
		||||
    this.ensureWasmInit()
 | 
			
		||||
      .then(async () => {
 | 
			
		||||
        this.ctxInstance = await this.create()
 | 
			
		||||
      })
 | 
			
		||||
      .catch(reportRejection)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Create a new context instance
 | 
			
		||||
 | 
			
		||||
@ -238,8 +238,9 @@ async function getAndSyncStoredToken(input: {
 | 
			
		||||
  if (token) {
 | 
			
		||||
    // has just logged in, update storage
 | 
			
		||||
    localStorage.setItem(TOKEN_PERSIST_KEY, token)
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-floating-promises
 | 
			
		||||
    isDesktop() && writeTokenFile(token)
 | 
			
		||||
    if (isDesktop()) {
 | 
			
		||||
      await writeTokenFile(token)
 | 
			
		||||
    }
 | 
			
		||||
    return token
 | 
			
		||||
  }
 | 
			
		||||
  if (!isDesktop()) return ''
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user