Skip to content

Commit

Permalink
fix: publish button for publish modal
Browse files Browse the repository at this point in the history
  • Loading branch information
m-abe-dev committed Sep 19, 2024
1 parent 13e4f7e commit ab71ba7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions web/src/beta/features/Editor/Publish/PublishToolsPanel/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ export default ({
const generateAlias = useCallback(() => generateRandomString(10), []);

const [validAlias, setValidAlias] = useState(false);
const alias = useMemo(
() => project?.alias ?? generateAlias(),
[project?.alias, generateAlias]
);
const [alias, setAlias] = useState<string>(project?.alias ?? generateAlias());

const [
checkProjectAlias,
Expand Down Expand Up @@ -110,6 +107,17 @@ export default ({
[project?.alias, checkProjectAlias]
);

useEffect(() => {
if (modalOpen) {
if (!alias) {
const generatedAlias = generateAlias();
setAlias(generatedAlias);
}

handleProjectAliasCheck(alias);
}
}, [modalOpen, alias, generateAlias, handleProjectAliasCheck]);

useEffect(() => {
setValidAlias(
!validatingAlias &&
Expand Down

0 comments on commit ab71ba7

Please sign in to comment.