diff --git a/lerna.json b/lerna.json index 89763cc..e1a302a 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": [ "packages/*" ], - "version": "0.1.0" + "version": "0.1.1" } diff --git a/packages/fronts-bundler/package.json b/packages/fronts-bundler/package.json index f878149..cf40a18 100644 --- a/packages/fronts-bundler/package.json +++ b/packages/fronts-bundler/package.json @@ -1,6 +1,6 @@ { "name": "fronts-bundler", - "version": "0.1.0", + "version": "0.1.1", "description": "", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", diff --git a/packages/fronts-react/package.json b/packages/fronts-react/package.json index 1dca3bb..0eed768 100644 --- a/packages/fronts-react/package.json +++ b/packages/fronts-react/package.json @@ -1,6 +1,6 @@ { "name": "fronts-react", - "version": "0.1.0", + "version": "0.1.1", "description": "", "main": "dist/index.cjs.js", "unpkg": "dist/index.umd.js", @@ -16,7 +16,7 @@ "react": "^16.13.0" }, "dependencies": { - "fronts": "^0.1.0" + "fronts": "^0.1.1" }, "devDependencies": { "@types/react": "^16.13.0", diff --git a/packages/fronts-react/src/useApp.tsx b/packages/fronts-react/src/useApp.tsx index 02e7653..dca711e 100644 --- a/packages/fronts-react/src/useApp.tsx +++ b/packages/fronts-react/src/useApp.tsx @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/ban-types */ import React, { useEffect, useRef, useState, useCallback, memo } from 'react'; -import { injectStyle, loadApp, Render, unmount } from 'fronts'; +import { getUid, injectStyle, loadApp, Render, unmount } from 'fronts'; import { AppWrapper, UseApp } from './interface'; /** @@ -38,13 +38,9 @@ export const useApp: UseApp = (options) => { callback && callback(); }; }, []); + const uid = getUid(options.name); return ( -
+
); diff --git a/packages/fronts-react/src/useIframe.tsx b/packages/fronts-react/src/useIframe.tsx index 465d0dc..977a7fd 100644 --- a/packages/fronts-react/src/useIframe.tsx +++ b/packages/fronts-react/src/useIframe.tsx @@ -1,5 +1,5 @@ import React, { memo, useCallback, useEffect, useState } from 'react'; -import { getIframeUrl } from 'fronts'; +import { getIframeUrl, getUid } from 'fronts'; import { UseIframe } from './interface'; /** @@ -22,7 +22,7 @@ export const useIframe: UseIframe = ({ name, url = '', attrs = {} }) => { setIframeUrl(url); }); }, []); - const uid = Math.random().toString(36).slice(2, -1); + const uid = getUid(name); return iframeUrl ? (