Skip to content

Commit

Permalink
Merge pull request #14512 from AUTOMATIC1111/remove-excessive-extra-n…
Browse files Browse the repository at this point in the history
…etworks-reload

reduce unnecessary re-indexing extra networks directory
  • Loading branch information
AUTOMATIC1111 authored Jan 3, 2024
2 parents 9c6ea53 + fccd0b0 commit 04a005f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/ui_extra_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,21 +417,21 @@ def create_ui(interface: gr.Blocks, unrelated_tabs, tabname):

dropdown_sort.change(fn=lambda: None, _js="function(){ applyExtraNetworkSort('" + tabname + "'); }")

def create_html():
ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]

def pages_html():
if not ui.pages_contents:
return refresh()

create_html()
return ui.pages_contents

def refresh():
for pg in ui.stored_extra_pages:
pg.refresh()

ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]

create_html()
return ui.pages_contents

interface.load(fn=pages_html, inputs=[], outputs=[*ui.pages])
interface.load(fn=pages_html, inputs=[], outputs=ui.pages)
button_refresh.click(fn=refresh, inputs=[], outputs=ui.pages)

return ui
Expand Down

0 comments on commit 04a005f

Please sign in to comment.