Add error boundary component and enhance API client configuration#12
Merged
moutonjeremy merged 1 commit intomainfrom Apr 19, 2026
Merged
Add error boundary component and enhance API client configuration#12moutonjeremy merged 1 commit intomainfrom
moutonjeremy merged 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and fixes across the codebase, focusing primarily on security, configuration flexibility, error handling, and code quality. The most significant change is the complete removal of JavaScript
eval/Functionusage in formula evaluation, replaced with a fully safe, recursive-descent parser. Additionally, the app now features a global error boundary for better runtime error handling, improved environment variable configuration for API and WebSocket URLs, and minor fixes to hooks.Security and Safety Improvements
src/lib/database/formula.ts: Replaced all uses ofeval/Functionin formula evaluation with a custom, safe recursive-descent parser for math and conditions. This eliminates code injection risks and ensures all formulas are securely parsed and evaluated. [1] [2] [3]Error Handling
src/components/error-boundary.tsx,src/App.tsx: Added a globalErrorBoundarycomponent that catches and displays runtime errors in the UI, preventing the app from crashing on uncaught errors. The mainAppcomponent is now wrapped in this boundary. [1] [2] [3] [4]Configuration and Environment Variables
README.md,src/api/client.ts,src/hooks/use-collaboration.ts: Improved documentation and code to support flexible configuration of API and collaboration WebSocket URLs via environment variables (VITE_API_URL,VITE_COLLAB_WS_URL). This makes deployment to different environments much easier and more robust. [1] [2] [3] [4]Hooks and Code Quality
src/hooks/ui/useEditableField.ts: Fixed a bug where timeouts could leak by using a ref and cleaning up on unmount, ensuring that delayed callbacks in editable fields do not cause memory leaks or unexpected behavior. [1] [2] [3]Documentation
README.md: Major update to the documentation, clarifying project setup, configuration, environment variables, and project structure for easier onboarding and environment management.