# v1.2.1 Release Notes

**Date:** 2026-02-09
**Changes since v1.2.0:** 2 commits

## Summary
Fixed configurator component substitution by updating to work with new pricelist-based pricing model. Addresses regression from v1.2.0 refactor that removed `CurrentPrice` field from components.

## Commits

### 1. Refactor: Remove CurrentPrice from local_components (5984a57)
**Type:** Refactor
**Files Changed:** 11 files, +167 insertions, -194 deletions

#### Overview
Transitioned from component-based pricing to pricelist-based pricing model:
- Removed `CurrentPrice` and `SyncedAt` from LocalComponent (metadata-only now)
- Added `WarehousePricelistID` and `CompetitorPricelistID` to LocalConfiguration
- Removed 2 unused methods: UpdateComponentPricesFromPricelist, EnsureComponentPricesFromPricelists

#### Key Changes
- **Data Model:**
  - LocalComponent: now stores only metadata (LotName, LotDescription, Category, Model)
  - LocalConfiguration: added warehouse and competitor pricelist references

- **Migrations:**
  - drop_component_unused_fields - removes CurrentPrice, SyncedAt columns
  - add_warehouse_competitor_pricelists - adds new pricelist fields

- **Quote Calculation:**
  - Updated to use pricelist_items instead of component.CurrentPrice
  - Added PricelistID field to QuoteRequest
  - Maintains offline-first behavior

- **API:**
  - Removed CurrentPrice from ComponentView
  - Components API no longer returns pricing

### 2. Fix: Load component prices via API (acf7c8a)
**Type:** Bug Fix
**Files Changed:** 1 file (web/templates/index.html), +66 insertions, -12 deletions

#### Problem
After v1.2.0 refactor, the configurator's autocomplete was filtering out all components because it checked for the removed `current_price` field on component objects.

#### Solution
Implemented on-demand price loading via API:
- Added `ensurePricesLoaded()` function to fetch prices from `/api/quote/price-levels`
- Added `componentPricesCache` to cache loaded prices in memory
- Updated all 3 autocomplete modes (single, multi, section) to load prices when input is focused
- Changed price validation from `c.current_price` to `hasComponentPrice(lot_name)`
- Updated cart item creation to use cached API prices

#### Impact
- Components without prices are still filtered out (as required)
- Price checks now use API data instead of removed database field
- Frontend loads prices on-demand for better performance

## Testing Notes
- ✅ Configurator component substitution now works
- ✅ Prices load correctly from pricelist
- ✅ Offline mode still supported (prices cached after initial load)
- ✅ Multi-pricelist support functional (estimate/warehouse/competitor)

## Known Issues
None

## Migration Path
No database migration needed from v1.2.0 - migrations were applied in v1.2.0 release.

## Breaking Changes
None for end users. Internal: `ComponentView` no longer includes `CurrentPrice` in API responses.
