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

Stop throwing in frontend code #2325

Open
1 of 21 tasks
dshaw opened this issue May 8, 2024 · 0 comments
Open
1 of 21 tasks

Stop throwing in frontend code #2325

dshaw opened this issue May 8, 2024 · 0 comments
Assignees
Labels
bug Something isn't working high priority

Comments

@dshaw
Copy link
Contributor

dshaw commented May 8, 2024

Throwing in Javascript and not handling the exception stops the execution engine, which means that the app will become unresponsive to users and it will be difficult to gracefully recover.

Proposed strategy:

  • Create a new Plausible event for “throw” since this will provide insight into how often the app is stopping due to existing code
    • This can be done before rearchitecting the thrown code’s user experience flows that follow
  • Assess if the existing throws actually need to stop the user experience
  • If the throw does not need to stop the user experience, implement a try/catch to handle the throw and implement a recovery strategy.
  • If the throw represents a point in the application state in which the app experience cannot recover:
    • coredump
    • Present the user with the error screen and the ability to refresh their application
  • Additionally, @jessfraz proposes implementing a linting rule to prevent throwing in React (components).

Known Instances:

  • /src/hooks/useBackdropHighlight.ts [Removed in Remove useBackdropHighlight #2323]
  • /src/clientSideScene/sceneEntities.ts 2X
  • /src/components/ActionButton.tsx
  • /src/editor/plugins/lsp/server-capability-registration.ts
  • /src/editor/plugins/lsp/codec/demuxer.ts
  • /src/editor/plugins/lsp/kcl/semantic_tokens.ts
  • /src/hooks/useRefreshSettings.ts
  • /src/lang/modifyAst.ts 2X
  • /src/lang/queryAst.ts
  • /src/lang/wasm.ts 7X
  • /src/lang/std/engineConnection.ts 6X
  • /src/lang/std/fileSystemManager.ts - Tauri related. May not apply.
  • /src/lang/std/sketch.ts 17X
  • /src/lang/std/sketchcombos.ts 2X
  • /src/lang/std/sketchConstraints.ts
  • /src/lib/coredump.ts 8X
  • /src/lib/createMachineCommand.ts
  • /src/lib/exampleKcl.ts
  • /src/lib/screenshot.ts 2X
  • /src/lib/testHelpers.ts 3X - probably not important since test related
  • /src/machines/authMachine.ts
  • NOTE: Throwing in tests is fine.

Additional context about throwing in React/Javascript:

@jessfraz jessfraz added this to the v1 Modeling App Launch milestone May 10, 2024
@jessfraz jessfraz added the bug Something isn't working label May 16, 2024
@dshaw dshaw mentioned this issue May 21, 2024
27 tasks
@lf94 lf94 self-assigned this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority
Projects
None yet
Development

No branches or pull requests

3 participants