Skip to content

Commit

Permalink
Fix enabled by default isMaxGasLimit (#1341)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitayutanov committed Jul 28, 2023
1 parent c951ac2 commit fa0bce1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion utils/gear-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gear-js/react-hooks",
"version": "0.5.26",
"version": "0.5.27",
"description": "React hooks used across Gear applications",
"author": "Gear Technologies",
"license": "GPL-3.0",
Expand Down
8 changes: 6 additions & 2 deletions utils/gear-hooks/src/hooks/api/useSendMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MAX_GAS_LIMIT = 250000000000;
function useSendMessage(
destination: HexString,
metadata: ProgramMetadata | undefined,
{ isMaxGasLimit = true, disableAlerts }: UseSendMessageOptions = {},
{ isMaxGasLimit = false, disableAlerts }: UseSendMessageOptions = {},
) {
const { api } = useContext(ApiContext); // сircular dependency fix
const { account } = useContext(AccountContext);
Expand Down Expand Up @@ -89,7 +89,11 @@ function useSendMessage(
api.message.signAndSend(address, { signer }, (result) => handleStatus(result, alertId, onSuccess, onError)),
)
.catch(({ message }: Error) => {
if (alertId) alert.update(alertId, message, DEFAULT_ERROR_OPTIONS);
if (alertId) {
alert.update(alertId, message, DEFAULT_ERROR_OPTIONS);
} else {
alert.error(message);
}

onError && onError();
});
Expand Down

0 comments on commit fa0bce1

Please sign in to comment.