sync: update from private repo (6fcb0d0)
This commit is contained in:
@@ -6,10 +6,15 @@ export function usePieceList() {
|
||||
return useQuery({ queryKey: ['pieces'], queryFn: fetchPieces, staleTime: STALE_TIME.SEMI_STATIC });
|
||||
}
|
||||
|
||||
export function usePiece(name: string | undefined) {
|
||||
/**
|
||||
* Fetches a single piece by name (and optional source).
|
||||
* Returns the full PieceFetchResult so callers can use the server-resolved source
|
||||
* for authorization decisions (e.g. read-only gate in PieceEditor).
|
||||
*/
|
||||
export function usePiece(name: string | undefined, source?: 'builtin' | 'user-custom' | 'global-custom') {
|
||||
return useQuery({
|
||||
queryKey: ['piece', name],
|
||||
queryFn: () => fetchPiece(name!),
|
||||
queryKey: ['piece', name, source],
|
||||
queryFn: () => fetchPiece(name!, source),
|
||||
enabled: !!name,
|
||||
staleTime: STALE_TIME.SEMI_STATIC,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user