Skip to content

Commit

Permalink
[async-storage]: Fix inline editing cursor jump (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Gallant committed Apr 25, 2024
1 parent 8fb692f commit d3e8fcd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/async-storage/webui/src/AsyncStorageTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function AsyncStorageTable() {
const { showAddEntryDialog, AddEntryDialog, showing } = useAddEntryDialog({ set });

const [initialUpdate, setInitialUpdate] = useState(false);
const [editingManually, setEditingManually] = useState(false);
useEffect(() => {
if (!initialUpdate && ready) {
update()
Expand Down Expand Up @@ -93,10 +94,16 @@ export function AsyncStorageTable() {
onInput(e) {
updateInProgressEdits({ [record.key]: e.currentTarget.textContent });
},
onBlur() {
setEditingManually(false)
},
onFocus() {
setEditingManually(true)
}
};
},
shouldCellUpdate(record, prevRecord) {
return record.editedValue !== prevRecord.editedValue;
return !editingManually && record.editedValue !== prevRecord.editedValue;
},
},
{
Expand Down

0 comments on commit d3e8fcd

Please sign in to comment.