Skip to content

update function component, small fix UI and logic improvement.#36

Open
jigo961257 wants to merge 8 commits into
johnuberbacher:masterfrom
javascript-with-jigo:master
Open

update function component, small fix UI and logic improvement.#36
jigo961257 wants to merge 8 commits into
johnuberbacher:masterfrom
javascript-with-jigo:master

Conversation

@jigo961257
Copy link
Copy Markdown

  • update the class component to function component of invoice component.
    💡 What: Optimized handleCalculateTotal to batch state updates and fixed a calculation bug.
    🎯 Why: The original implementation had a bug where subTotal became a string during the loop, causing incorrect totals (e.g., "10.00" + 20 = "10.0020"). It also triggered 4 separate re-renders for every calculation update due to chained setState calls.
    📊 Impact:
  • Fixes incorrect invoice totals for multiple items.
  • Reduces re-renders by ~75% during calculation updates (from 4 to 1).
  • Improves responsiveness of input fields.
    🔬 Measurement:
  • src/components/InvoiceForm.test.js verifies the correct calculation for multiple items.
  • Manual verification confirms UI updates correctly and totals are accurate.

google-labs-jules Bot and others added 8 commits January 12, 2026 12:46
- Fixes a critical bug where invoice totals were calculated incorrectly due to string concatenation in the loop.
- Optimizes `handleCalculateTotal` to use a single `setState` call instead of 4 chained calls, reducing re-renders.
- Adds regression test in `src/components/InvoiceForm.test.js`.
…on-batch-state-2032289671949705086

⚡ Bolt: Fix invoice total calculation and optimize re-renders
- Converted App, InvoiceForm, InvoiceItem, EditableField, InvoiceModal to functional components.
- Added unit tests in InvoiceForm.test.js.
- Fixed duplicate ID issue in EditableField.
- Modernized state management using Hooks.
- Fixed linter warnings.
- Fixed equality checks.
- Converted App, InvoiceForm, InvoiceItem, EditableField, InvoiceModal to functional components.
- Modernized state management using Hooks (useState, useEffect, useCallback).
- Resolved merge conflicts with remote branch.
- Added comprehensive unit tests in InvoiceForm.test.js.
- Fixed duplicate ID issue in EditableField.
- Addressed linter warnings and equality checks.
…omponents-2435297311794581701

Refactor to Functional Components
…omponents-2435297311794581701

add the build script update for netlify
@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 12, 2026

Deploy Preview for invoice-generator-react failed.

Name Link
🔨 Latest commit 9814106
🔍 Latest deploy log https://app.netlify.com/projects/invoice-generator-react/deploys/6964fef32ac4e50008c13188

@jigo961257
Copy link
Copy Markdown
Author

here I add the environment variable in the netlify as following

NODE_OPTIONS = --openssl-legacy-provider

Copy link
Copy Markdown

@codeCraft-Ritik codeCraft-Ritik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work on this implementation — very clean and well-organized

@Shubhmop
Copy link
Copy Markdown

Shubhmop commented Mar 6, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants