Skip to content

Commit

Permalink
improvement for useParams hook and navigate
Browse files Browse the repository at this point in the history
  • Loading branch information
wpdas committed Mar 11, 2024
1 parent 8b7eec6 commit c25a65e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions lib/tools/hooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const useParams = () => {
const { parameterName } = useAlemLibRoutesStore();
// Remove "path" (being used internally)
if (Object.keys(props).includes("path")) {
delete props.path;
if (Object.keys(props).includes(parameterName)) {
delete props[parameterName];
}
return props;
};
Expand Down
9 changes: 6 additions & 3 deletions lib/tools/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ export const navigate = (routePath) => {
const { routes, update } = useAlemLibRoutesStore();

if (routes.includes(routePath)) {
// Umblock route to bypass "path=" parameter and change route
State.update({ alemRouteBlocked: false });
update({ activeRoute: routePath });
// Wait next tick to prevent invisible conflicts
setTimeout(() => {
// Umblock route to bypass "path=" parameter and change route
State.update({ alemRouteBlocked: false });
update({ activeRoute: routePath });
}, 0);
}
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alem",
"description": "Create web3 applications for NEAR BOS with a focus on performance while using concepts that are based on ReactJS.",
"version": "0.0.1-alpha.19",
"description": "Create web3 applications for NEAR BOS with a focus on performance and friendly development.",
"version": "0.0.1-alpha.20",
"main": "main.js",
"types": "index.d.ts",
"author": "Wenderson Pires - wendersonpires.near",
Expand Down

0 comments on commit c25a65e

Please sign in to comment.