Skip to content

Commit

Permalink
Merge pull request #2382 from decentdao/hotfix/v0.3.4
Browse files Browse the repository at this point in the history
Hotfix/v0.3.4
  • Loading branch information
adamgall authored Sep 27, 2024
2 parents fe328a9 + 5d1c3f0 commit e4b7643
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "decent-interface",
"version": "0.3.3",
"version": "0.3.4",
"private": true,
"dependencies": {
"@amplitude/analytics-browser": "^2.11.1",
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/DAO/useDAOController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ export default function useDAOController() {
useKeyValuePairs();
useHatsTree();

return { invalidQuery, wrongNetwork, errorLoading };
return { invalidQuery, wrongNetwork, errorLoading, urlAddressPrefix: addressPrefix };
}
17 changes: 16 additions & 1 deletion src/pages/DAOController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { Outlet } from 'react-router-dom';
import { toast } from 'react-toastify';
import { useSwitchChain } from 'wagmi';
import { logError } from '../helpers/errorLogging';
import useDAOController from '../hooks/DAO/useDAOController';
import { useUpdateSafeData } from '../hooks/utils/useUpdateSafeData';
import { useFractal } from '../providers/App/AppProvider';
import { getChainIdFromPrefix } from '../utils/url';
import LoadingProblem from './LoadingProblem';

const useTemporaryProposals = () => {
Expand Down Expand Up @@ -32,14 +35,26 @@ const useTemporaryProposals = () => {
};

export default function DAOController() {
const { errorLoading, wrongNetwork, invalidQuery } = useDAOController();
const { switchChain } = useSwitchChain();
const { errorLoading, wrongNetwork, invalidQuery, urlAddressPrefix } = useDAOController();
useUpdateSafeData();
const {
node: { daoName },
} = useFractal();

useTemporaryProposals();

useEffect(() => {
if (urlAddressPrefix && wrongNetwork) {
try {
switchChain({ chainId: getChainIdFromPrefix(urlAddressPrefix) });
window.location.reload();
} catch (e) {
logError(e);
}
}
}, [wrongNetwork, switchChain, urlAddressPrefix]);

useEffect(() => {
if (daoName) {
document.title = `${import.meta.env.VITE_APP_NAME} | ${daoName}`;
Expand Down
6 changes: 6 additions & 0 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const router = (addressPrefix: string) =>
// @ts-ignore:next-line
loader: ({ params: { daoAddress } }) =>
redirect(DAO_ROUTES.modifyGovernance.relative(addressPrefix, daoAddress)),
// @todo - this redirect doesn't work anymore for some reason
},
{
path: DAO_ROUTES.hierarchy.path,
Expand Down Expand Up @@ -105,6 +106,7 @@ export const router = (addressPrefix: string) =>
// @ts-ignore:next-line
loader: ({ params: { daoAddress } }) =>
redirect(DAO_ROUTES.newSubDao.relative(addressPrefix, daoAddress)),
// @todo - this redirect doesn't work anymore for some reason
},
{
path: 'proposal-templates',
Expand All @@ -122,6 +124,7 @@ export const router = (addressPrefix: string) =>
// @ts-ignore:next-line
loader: ({ params: { daoAddress } }) =>
redirect(DAO_ROUTES.proposalTemplateNew.relative(addressPrefix, daoAddress)),
// @todo - this redirect doesn't work anymore for some reason
},
],
},
Expand All @@ -145,6 +148,7 @@ export const router = (addressPrefix: string) =>
// @ts-ignore:next-line
loader: ({ params: { daoAddress } }) =>
redirect(DAO_ROUTES.proposalNew.relative(addressPrefix, daoAddress)),
// @todo - this redirect doesn't work anymore for some reason
},
{
path: 'new/sablier/*',
Expand All @@ -158,6 +162,7 @@ export const router = (addressPrefix: string) =>
DAO_ROUTES.proposalNew
.relative(addressPrefix, daoAddress)
.replace('new', 'new/sablier'),
// @todo - this redirect doesn't work anymore for some reason
),
},
],
Expand All @@ -179,6 +184,7 @@ export const router = (addressPrefix: string) =>
// @ts-ignore:next-line
loader: ({ params: { daoAddress } }) =>
redirect(DAO_ROUTES.dao.relative(addressPrefix, daoAddress)),
// @todo - this redirect doesn't work anymore for some reason
},
{
path: '*', // 404
Expand Down

0 comments on commit e4b7643

Please sign in to comment.