From 4d330e097518fe4c031663a8738fa7e6f3931269 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 10 Oct 2024 10:51:32 +0200 Subject: [PATCH] fix arguments & event bubbling --- apps/vyper/src/app/app.tsx | 2 +- libs/remix-ui/renderer/src/lib/renderer.tsx | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index 8004d9c210..8e8c69eca1 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -189,7 +189,7 @@ const App = () => { type: 'error', errorType: error.error_type, errCol: error.column, - errLine: error.line - 1, + errLine: error.line ? error.line - 1 : null, errFile: contract }} /> diff --git a/libs/remix-ui/renderer/src/lib/renderer.tsx b/libs/remix-ui/renderer/src/lib/renderer.tsx index d858902295..e91c85168e 100644 --- a/libs/remix-ui/renderer/src/lib/renderer.tsx +++ b/libs/remix-ui/renderer/src/lib/renderer.tsx @@ -27,9 +27,9 @@ export const Renderer = ({ message, opt, plugin }: RendererProps) => { useSpan: false, type: '', errorType: '', - errCol: undefined, - errLine: undefined, - errFile: undefined + errCol: null, + errLine: null, + errFile: null }) const [classList, setClassList] = useState(opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning') const [close, setClose] = useState(false) @@ -50,10 +50,9 @@ export const Renderer = ({ message, opt, plugin }: RendererProps) => { if (!opt.errLine) { const positionDetails = helper.getPositionDetails(text) - - opt.errLine = positionDetails.errLine as number - opt.errCol = positionDetails.errCol as number - opt.errFile = positionDetails.errFile ? (positionDetails.errFile as string).trim() : '' + opt.errLine = !opt.errLine ? positionDetails.errLine as number : opt.errLine + opt.errCol = !opt.errCol ? positionDetails.errCol as number : opt.errCol + opt.errFile = !opt.errFile ? (positionDetails.errFile ? (positionDetails.errFile as string).trim() : '') : opt.errFile } setMessageText(text) @@ -123,7 +122,7 @@ export const Renderer = ({ message, opt, plugin }: RendererProps) => { { askGtp() }} + onClick={(event) => { event.preventDefault(); askGtp() }} style={{ borderColor: "var(--ai)" }} > Ask RemixAI