# State Management - FikoYT

## 🔄 Signal Pattern

**Angular 20+ Signal:**
```typescript
// Reactive state
public yukleniyor = signal(false);
public seciliNesne = signal<FikoObje3D | null>(null);

// Update
this.yukleniyor.set(true);
this.seciliNesne.set(yeniNesne);
```

## 📡 Socket.io State

**Real-time sync:**
```typescript
// Client emit
await this.socket.gonder("nesne:guncelle", data);

// Server broadcast
socket.Emit("nesne:guncellendi", veri);
```

## 💾 Local Storage

**Dexie (IndexedDB):**
```typescript
// Dexie service
export class FikoYTDb extends Dexie {
  settings!: Table<Setting>;
  drawings!: Table<Drawing>;
}
```

## 🏠 Session Store

**MongoDB Sessions:**
```go
// Go backend
MongoStore = mongodb.New(mongodb.Config{
    ConnectionURI: os.Getenv("mongo_uri"),
    Database: "fikoyt",
    Collection: "go_sessions",
})
```

## 📦 Component State

**Dialog Cache:**
- Component'ler destroy edilmez
- DOM'da gizle/göster
- State korunur

## 🎯 Global State

**FikoYTService:**
- Kullanıcı bilgileri
- Cihaz yönetimi
- Shared state

## ⚠️ Kritik

- **Signal:** Angular 20+ kullan
- **Socket:** Real-time sync
- **Cache:** Dialog system
- **Session:** MongoDB backed

---
2025-11-06
