fix: transfer NodeTextBoxInput to use local state to fix cursor jump (#10410)

<!-- Clearly explain the need for these changes: -->

### Changes 🏗️

<!-- Concisely describe all of the changes made in this pull request:
-->

This PR contains code changes that will resolve the cursor jump issue in
the **Note** block #9252 . The changes in code affects the
NodeTextBoxInput component to transfer the state into local state and
not mutate the `value` prop directly.

Also includes change to use store admin which is from rebase issue but
approved by maintainer @ntindle

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Tested the note block allows to edit text normally
 


https://github.com/user-attachments/assets/f2800bf1-9867-4627-ac9d-44718627b263

---------

Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
Co-authored-by: Abhimanyu Yadav <122007096+Abhi1992002@users.noreply.github.com>
Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co>
Co-authored-by: Ubbe <hi@ubbe.dev>
This commit is contained in:
Nwani Victory
2025-07-24 19:37:09 +01:00
committed by GitHub
parent b0e81316e4
commit f78614247f
2 changed files with 11 additions and 3 deletions

View File

@@ -131,7 +131,7 @@ async def admin_download_agent_file(
Raises:
HTTPException: If the agent is not found or an unexpected error occurs.
"""
graph_data = await backend.server.v2.store.db.get_agent(
graph_data = await backend.server.v2.store.db.get_agent_as_admin(
user_id=user.user_id,
store_listing_version_id=store_listing_version_id,
)

View File

@@ -1144,6 +1144,13 @@ export const NodeTextBoxInput: FC<{
displayName,
}) => {
value ||= schema.default || "";
const [localValue, setLocalValue] = useState(value || schema.default || "");
useEffect(() => {
setLocalValue(value || schema.default || "");
}, [value, schema.default]);
return (
<div className={className}>
<div
@@ -1152,12 +1159,13 @@ export const NodeTextBoxInput: FC<{
>
<textarea
id={selfKey}
value={schema.secret && value ? "********" : value}
value={schema.secret && localValue ? "********" : localValue}
onChange={(e) => setLocalValue(e.target.value)}
onBlur={() => handleInputChange(selfKey, localValue)}
readOnly={schema.secret}
placeholder={
schema?.placeholder || `Enter ${beautifyString(displayName)}`
}
onChange={(e) => handleInputChange(selfKey, e.target.value)}
className="h-full w-full resize-none overflow-hidden border-none bg-transparent text-lg text-black outline-none dark:text-white"
style={{
fontSize: "min(1em, 16px)",