Generate workspace element IDs on HTTP origins without randomUUID
studio CI and deployment / verify-and-deploy (push) Successful in 5m5s

This commit is contained in:
2026-10-27 21:06:58 +08:00
parent c5b80739db
commit fef96a5819
3 changed files with 8 additions and 4 deletions
+2
View File
@@ -2,6 +2,8 @@ import type {CSSProperties} from 'react';
import type {Layout,Parameters,Slot} from './layout-parameters';
export type Design={id:string;name:string;layoutId:string;parameters:Parameters;revision:number;url:string};
// getRandomValues is available on the deployment's HTTP origin; randomUUID is not.
export const newElementId=()=> 'user-'+Array.from(globalThis.crypto.getRandomValues(new Uint32Array(4)),n=>n.toString(16).padStart(8,'0')).join('');
export const emptyParameters=():Parameters=>({texts:{},images:{},decorations:{}});
export const designUrl=(layoutId:string,id:string)=>`/studio/layouts/${layoutId}?id=${id}`;
export function nativeLayout(layout:Layout):Layout {