# Duplicate execution of the same operation in code

**URL:** <https://forums.ankiweb.net/t/duplicate-execution-of-the-same-operation-in-code/30943>\
**Category:** Development\
**Created:** [June 5, 2023, 11:30pm UTC](https://forums.ankiweb.net/t/duplicate-execution-of-the-same-operation-in-code/30943 "2023-06-05T23:30:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MIZMU](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@MIZMU](https://forums.ankiweb.net/u/MIZMU)\
**Post date:** [June 5, 2023, 11:30pm UTC](https://forums.ankiweb.net/t/duplicate-execution-of-the-same-operation-in-code/30943/1 "2023-06-05T23:30:12Z")

</div>

Why does self.\_renderPage() need to be repeated twice in a short code snippet:  
In the aqt.deckbrowser on line 70 and line 73 there is another call “self.refresh()” that again executes self.\_renderPage()?

```auto
        self._renderPage()
        # redraw top bar for theme change
        self.mw.toolbar.redraw()
        self.refresh()

    def refresh(self) -> None:
        self._renderPage()
        self._refresh_needed = False

```

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [June 7, 2023, 6:11am UTC](https://forums.ankiweb.net/t/duplicate-execution-of-the-same-operation-in-code/30943/2 "2023-06-07T06:11:00Z")

</div>

Looks like a mistake - I’ve pushed a fix.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [July 7, 2023, 6:13am UTC](https://forums.ankiweb.net/t/duplicate-execution-of-the-same-operation-in-code/30943/3 "2023-07-07T06:13:35Z")

</div>

Closed on July 7, 2023, 6:13am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
