Mohamad Tarbin d28ecb509e Performance optimization 09 24 (#6)
* perf: optimize MyChores component performance and fix timer errors

## Fixed Issues
-  Timer error: `Timer '🏁 Main useEffect processing' does not exist`
-  Reduced 1049ms and 613ms message handler violations
-  Fixed 1+ second blank screen before chores display
-  Eliminated multiple redundant `getFilteredChores` calculations

## Performance Optimizations

### 1. Fixed Timer Execution Issue
**Problem**: React strict mode was causing timer mismatch between `console.time` and `console.timeEnd`
**Solution**: Restructured async useEffect to ensure proper timer lifecycle
```javascript
// Before: Timer in async IIFE caused double-execution issues
;(async () => {
  console.time('🏁 Main useEffect processing')
  // ...
  console.timeEnd('🏁 Main useEffect processing')
})()

// After: Proper async function structure
const processEffectAsync = async () => {
  // ... async operations
  console.timeEnd('🏁 Main useEffect processing')
}
processEffectAsync()
```

### 2. Optimized useState Lazy Initialization
**Problem**: `JSON.parse()` called on every render for state initialization
```javascript
// Before: Expensive operation on each render
const [openChoreSections, setOpenChoreSections] = useState(
  JSON.parse(localStorage.getItem('openChoreSections')) || {},
)

// After: Lazy initialization with error handling
const [openChoreSections, setOpenChoreSections] = useState(() => {
  try {
    return JSON.parse(localStorage.getItem('openChoreSections')) || {}
  } catch {
    return {}
  }
})
```

### 3. Reduced useEffect Dependencies
**Problem**: useEffect running too frequently due to object reference dependencies
```javascript
// Before: Full objects cause frequent re-runs
}, [choresData, membersData, userProfile, impersonatedUser, ...]

// After: Only specific properties that matter
}, [choresData?.res, membersData?.res, userProfile?.id, impersonatedUser?.userId, ...]
```

### 4. Added Memoization for Section Updates
**Problem**: `choreSections` updated even when data hadn't actually changed
```javascript
// Before: Always updating sections
setChoreSections(processedSections)

// After: Only update if data actually changed
setChoreSections(prevSections => {
  if (JSON.stringify(prevSections) === JSON.stringify(processedSections)) {
    return prevSections
  }
  return processedSections
})
```

### 5. Optimized localStorage Access
**Problem**: Multiple `localStorage.getItem()` calls and repeated parsing
```javascript
// Before: Multiple localStorage calls
if (localStorage.getItem('openChoreSections') === null) {
  // ...localStorage operations
}

// After: Single cached read
const storedSections = localStorage.getItem('openChoreSections')
if (storedSections === null) {
  // ...operations
}
```

### 6. Added useMemo/useCallback for Heavy Computations
- `processedChores` - Memoized chore sorting and filtering
- `processedSections` - Memoized section grouping
- `getFilteredChores` - Memoized filtered chore calculations
- `handleChoreUpdated`, `handleChoreDeleted`, `updateChores` - useCallback for stable references

## Performance Results
**Before**: 1+ second loading delay, timer errors, frequent violations
**After**:
- `processedChores calculation: ~0.002ms` (was much slower)
- `processedSections calculation: ~0.001ms` (was much slower)
- `getFilteredChores: ~0.022ms` (down from multiple slow calls)
- `Main useEffect processing: ~0.298ms` (reasonable time)
- `Auto-update sections: ~0.007ms` (very fast)

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: update package.json to remove deprecated @vitejs/plugin-react dependency and add wrangler.toml for build configuration

* Revert vite.config.js to it's original state

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-26 02:21:07 -04:00
2025-01-11 08:39:59 -08:00
2024-12-26 02:13:47 -05:00
2024-12-26 02:13:47 -05:00
2024-12-26 02:13:47 -05:00
2025-09-26 02:21:07 -04:00
2024-12-26 02:13:47 -05:00
2024-12-26 02:13:47 -05:00
2024-12-26 02:13:47 -05:00
2024-12-26 02:13:47 -05:00
2025-03-05 19:49:00 -05:00

Logo

Donetick Frontend

The Donetick Frontend is Frontend piece for Donetick written in javascript with React

What is Donetick?

An open-source, user-friendly app for managing tasks and chores, featuring customizable options to help you and others stay organized.

Why I made Donetick?

As an avid for open-source, I was eager to create a solution that could benefit the wider community. Donetick started as a personal project to address my own chore management needs, but it has evolved into bigger tool and decide to open source it for anyone seeking a customizable and privacy-focused task management tool

Features

  • Task and Chore Management: Easily create, edit, and manage tasks and chores for yourself or your group.
  • Shared To-Do Lists: Create "Circles" to collaborate on tasks with family or your group
  • Assignee Assignment: Assign tasks to specific individuals or rotate them automatically using customizable strategies.
  • Recurring Tasks: Schedule tasks to repeat daily, weekly, monthly, or yearly, with flexible customization options.
  • Progress Tracking: Track the completion status of tasks and view historical data.

Installation

  1. Clone the repository:
  2. Navigate to the project directory: cd frontend
  3. Download dependency npm install
  4. Run locally npm start

Contributing

Contributions are welcome! If you would like to contribute to Donetick, please follow these steps:

  1. Fork the repository
  2. Create a new branch: git checkout -b feature/your-feature-name
  3. Make your changes and commit them: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/your-feature-name
  5. Submit a pull request

Need Help:

Donetick is a work in progress and has been a fantastic learning experience for me as I've honed my React skills,I'm looking for collaborators to help improve and refine the Donetick. Feel free to open PR or suggest changes.

Plans :

My goal is to expand Donetick by offering a hosted infrastructure option. This will make it even easier for users to access and utilize Donetick's features without the need for self-hosting.

While maintaining Donetick's commitment to open source, this hosted option will provide a seamless, out-of-the-box experience for those who prefer a managed solution.

License

This project is licensed under the AGPLv3 License. See the LICENSE file for more details. I might consider changing it later to something else

Description
Donetick frontend fork (Titan 2 Elite custom build)
Readme 7 MiB
2026-08-18 14:50:46 +02:00
Languages
JavaScript 93.9%
Java 1.8%
CSS 1.8%
Swift 1.7%
Shell 0.5%
Other 0.2%