ng-conf 2026 in Salt Lake City covers Angular 18+ features including the Signals-based reactivity model, standalone components, and NgRx Signal Store. UUID v7 sessions address client-side ID generation for optimistic UI updates — assigning a UUID v7 before the server responds lets Angular render immediately and reconcile later. See UUID v7 in JavaScript for the generation API.
Angular service with UUID v7
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { v7 as uuidv7 } from 'uuid';
export interface Order {
id: string;
customerId: string;
total: number;
status: string;
}
@Injectable({ providedIn: 'root' })
export class OrderService {
constructor(private http: HttpClient) {}
createOrder(customerId: string, total: number) {
const order: Order = {
id: uuidv7(), // UUID v7 — client-generated, time-ordered
customerId,
total,
status: 'pending',
};
return this.http.post<Order>('/api/orders', order);
}
}
NgRx Signal Store with UUID v7 entity IDs
import { signalStore, withEntities, withMethods } from '@ngrx/signals';
import { setEntities, addEntity } from '@ngrx/signals/entities';
import { v7 as uuidv7 } from 'uuid';
interface Order { id: string; total: number; status: string }
export const OrderStore = signalStore(
withEntities<Order>(),
withMethods((store) => ({
addOrder(total: number) {
const order: Order = { id: uuidv7(), total, status: 'pending' };
// addEntity inserts and sorts by id — UUID v7 = chronological
patchState(store, addEntity(order));
},
})),
);
Angular Signals — computed sort by UUID v7
import { computed, signal } from '@angular/core';
import { v7 as uuidv7 } from 'uuid';
const orders = signal<Order[]>([]);
// UUID v7 lexicographic sort = creation order — no createdAt needed
const sortedOrders = computed(() =>
[...orders()].sort((a, b) => a.id.localeCompare(b.id))
);
// Extract creation time from UUID v7 ID
function createdAt(id: string): Date {
const hex = id.replace(/-/g, '').slice(0, 12);
return new Date(parseInt(hex, 16));
}
Optimistic UI update pattern
// 1. Generate UUID v7 client-side
// 2. Optimistically add to local state
// 3. POST to server with same ID
// 4. Server stores the ID — no reconciliation needed
async function createOrderOptimistic(customerId: string, total: number) {
const order: Order = { id: uuidv7(), customerId, total, status: 'pending' };
// Immediately update UI
orders.update(list => [...list, order]);
try {
await firstValueFrom(orderService.createOrder(customerId, total));
} catch (err) {
// Rollback on failure
orders.update(list => list.filter(o => o.id !== order.id));
throw err;
}
}
Further reading
External references
Frequently asked questions
How do I generate UUID v7 in Angular?
Install the uuid npm package: npm install uuid. Import import { v7 as uuidv7 } from 'uuid' in any Angular service or component. UUID generation is synchronous and has no Angular-specific dependencies — it works in services, components, NgRx effects, and signal store actions. See UUID v7 in JavaScript.
How does UUID v7 work with NgRx entity IDs?
NgRx EntityAdapter uses a selectId function to identify entities. UUID v7 strings work as entity IDs. With sortComparer: (a, b) => a.id.localeCompare(b.id), entities sort in creation order because UUID v7 is lexicographically time-ordered. This removes the need for a separate createdAt field for display ordering. See UUID v4 vs UUID v7.
Can Angular Signals use UUID v7 keys?
Yes. Angular Signals are reactive wrappers over values — UUID v7 strings work as Map keys, entity IDs in computed signals, and resource identifiers for httpResource calls. Time-ordered UUIDs provide natural sort order for computed derivations like computed(() => entities().sort((a,b) => a.id.localeCompare(b.id))).