Fix 7 bugs: bounds checks, deepcopy, time import, JS keys, unused import

- Add bounds check on src_batch index in add_from_source and copy_source
- Guard delete callback against stale index after rapid clicks
- Replace __import__('time').time() with time.time() in sync_to_db
- Use deepcopy(DEFAULTS) consistently in utils.py and main.py
- Use JSON.stringify in JS onConfigure fallback path for key storage
- Read state.show_comfy_monitor for checkbox initial value
- Remove unused KEY_BATCH_DATA import from tab_projects_ng

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 20:41:00 +01:00
parent 497e6b06fb
commit 1b8d13f7c4
5 changed files with 18 additions and 15 deletions

View File

@@ -273,7 +273,7 @@ def render_batch_processor(state: AppState):
item = copy.deepcopy(DEFAULTS)
src_batch = _src_cache['batch']
sel_idx = src_seq_select.value
if src_batch and sel_idx is not None:
if src_batch and sel_idx is not None and int(sel_idx) < len(src_batch):
item.update(copy.deepcopy(src_batch[int(sel_idx)]))
elif _src_cache['data']:
item.update(copy.deepcopy(_src_cache['data']))
@@ -398,7 +398,7 @@ def _render_sequence_card(i, seq, batch_list, data, file_path, state,
item = copy.deepcopy(DEFAULTS)
src_batch = src_cache['batch']
sel_idx = src_seq_select.value
if src_batch and sel_idx is not None:
if src_batch and sel_idx is not None and int(sel_idx) < len(src_batch):
item.update(copy.deepcopy(src_batch[int(sel_idx)]))
elif src_cache['data']:
item.update(copy.deepcopy(src_cache['data']))
@@ -453,8 +453,9 @@ def _render_sequence_card(i, seq, batch_list, data, file_path, state,
# Delete
def delete(idx=i):
batch_list.pop(idx)
commit()
if idx < len(batch_list):
batch_list.pop(idx)
commit()
ui.button(icon='delete', on_click=delete).props('color=negative')