Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flickering page when renaming #187

Merged
merged 7 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#187](https://github.com/alleslabs/celatone-frontend/pull/187) Fix renaming list flicker to the all lists for a second
- [#185](https://github.com/alleslabs/celatone-frontend/pull/185) Fix sentry in next.config.js
- [#183](https://github.com/alleslabs/celatone-frontend/pull/183) Fix build failed because sentry env
- [#175](https://github.com/alleslabs/celatone-frontend/pull/175) Fix css related issue and tag selection input
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/modal/list/EditListName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export function EditListNameModal({
handleSave();
if (reroute)
navigate({
pathname: `/contract-list/${formatSlugName(listName)}`,
pathname: "/contract-list/[slug]",
query: { slug: formatSlugName(listName) },
replace: true,
});
}}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/contract-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const AllContractListsPage = observer(() => {
const contractLists = [useInstantiatedMockInfoByMe(), ...getContractLists()];

const handleListSelect = (slug: string) => {
navigate({ pathname: `/contract-list/${slug}` });
navigate({ pathname: "/contract-list/[slug]", query: { slug } });
};

return (
Expand Down
9 changes: 6 additions & 3 deletions src/lib/pages/contract-list/slug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ const ContractsByList = observer(() => {
: getContractLists().find((item) => item.slug === listSlug);

useEffect(() => {
if (isHydrated && contractListInfo === undefined) {
navigate({ pathname: "/contract-list" });
}
// TODO: find a better approach?
const timeoutId = setTimeout(() => {
if (isHydrated && contractListInfo === undefined)
navigate({ pathname: "/contract-list" });
}, 100);
return () => clearTimeout(timeoutId);
}, [contractListInfo, isHydrated, navigate]);

if (!contractListInfo) return null;
Expand Down
10 changes: 8 additions & 2 deletions src/lib/pages/instantiate/component/InstantiateOffchainForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ export const InstantiateOffChainForm = observer(
data.tags,
data.lists
);
navigate({ pathname: "/contract-list/instantiated-by-me" });
navigate({
pathname: "/contract-list/[slug]",
query: { slug: "instantiated-by-me" },
});
})();
};

Expand Down Expand Up @@ -109,7 +112,10 @@ export const InstantiateOffChainForm = observer(
w="128px"
variant="outline-gray"
onClick={() =>
navigate({ pathname: "/contract-list/instantiated-by-me" })
navigate({
pathname: "/contract-list/[slug]",
query: { slug: "instantiated-by-me" },
})
}
>
Skip
Expand Down