# Button Action re-triggered when tab becomes visible

**URL:** <https://community.glideapps.com/t/button-action-re-triggered-when-tab-becomes-visible/23487>\
**Category:** Report a Bug\
**Created:** [February 26, 2021, 8:46pm UTC](https://community.glideapps.com/t/button-action-re-triggered-when-tab-becomes-visible/23487 "2021-02-26T20:46:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CESI](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cesi/32/4919_2.png) [@CESI](https://community.glideapps.com/u/CESI)\
**Post date:** [February 26, 2021, 8:46pm UTC](https://community.glideapps.com/t/button-action-re-triggered-when-tab-becomes-visible/23487/1 "2021-02-26T20:46:12Z")

</div>

I’m encountering a very strange bug where a button’s custom action is triggering WITHOUT having clicked the button.

It happens in a very specific circumstance after the button is clicked and its tab becomes hidden then visible again. When the tab becomes visible again it immediately triggers the custom action with the same stale values that existed when the button was last pressed. This repeats each time the tab is made visible again unless I manually navigate to another tab first or switch to the data view and back.

Unfortunately this is one piece of a larger Pro app that’s already in production so I cannot share the link. Could make a copy & share if desired though.

Step by Step

- I click the ‘Start’ button on my Home tab with a custom action
  - It sets a user-specific column ‘CurrentQuestion’ to ‘begin’
  - The ‘Survey’ menu tab is set to be visible when ‘CurrentQuestion’ is not empty.
  - It then navigates to the ‘Survey’ tab

- The app navigates to the Survey tab
- On that tab is a ‘Submit’ button with a custom action
  - IF ‘CurrentQuestion’ = ‘save’
    - Show Notification(CurrentQuestion)
    - SetColumn(CurrentQuestion=’done’)

- When I press Submit it works as expected by showing a notification that says ‘save’
- The tab then shows another ‘Return to Home’ button with a custom action
  - SetColumn(CurrentQuestion=ClearValue)
  - Navigate to Home

- This brings me back to the Home tab
- **The really weird part starts if I press the ‘Start’ button again**
- The app navigates back to the Survey tab and I immediately a notification that says ‘save’.
  - I have NOT pressed the Submit button again, it’s not even visible at this point
  - The value of CurrentQuestion is not ‘save’, so the action is somehow caching an old value that it’s using for the condition logic and the notification text
  - This repeats indefinitely UNLESS I navigate to another tab other than Home or switch from the builder view to the data view.
  - This also happens on my phone, not just in the designer.

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)\
**Post date:** [February 26, 2021, 8:55pm UTC](https://community.glideapps.com/t/button-action-re-triggered-when-tab-becomes-visible/23487/2 "2021-02-26T20:55:42Z")

</div>

Interesting – this might be the cause of some very subtle bugs we’ve been trying to fix.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 26, 2021, 9:06pm UTC](https://community.glideapps.com/t/button-action-re-triggered-when-tab-becomes-visible/23487/3 "2021-02-26T21:06:31Z")

</div>

Sounds kind of similar to what I’ve experienced with an action on on inline list getting fired when a new row is added.

Mentioned it here with an example app:

> [@23 duplicate entries using "Add Row" action](https://community.glideapps.com/t/23-duplicate-entries-using-add-row-action/22202/18):
>
> OK, I think I do see an error in the logic of my app and I would have to agree, that in my case, an action isn’t being triggered remotely, but something still isn’t right. I made a simpler example to show what I’m seeing. If you add a task, you will see in that list description that the ParentID-Selected column gets populated when the task is added to the list. The only time that column should ever be altered is when clicking on the task within the list. Somehow, the Add Row action is firing…

That stemmed from one of the apps here:

> [@Reset Multiple Rows At Once](https://community.glideapps.com/t/reset-multiple-rows-at-once/22211):
>
> There have been several requests for people to find a way to clear a value in multiple rows. I was thinking about that and came up with a quick example of a way to handle that. Instead of trying to clear a value in an entire column, I realized we could just change one value on a parent column, load it as a single value in our sheet and then compare that parent value to a column that we set or unset for each row. It’s not about clearing an entire column, it’s about making a value in each row n…

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)\
**Post date:** [February 26, 2021, 11:04pm UTC](https://community.glideapps.com/t/button-action-re-triggered-when-tab-becomes-visible/23487/4 "2021-02-26T23:04:20Z")

</div>

@Jonathon_Kohn does this sound familiar?

---

<div class="post-metadata">

**Author:** ![Jonathon\_Kohn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jonathon_kohn/32/8593_2.png) [@Jonathon\_Kohn](https://community.glideapps.com/u/Jonathon_Kohn)\
**Post date:** [February 26, 2021, 11:29pm UTC](https://community.glideapps.com/t/button-action-re-triggered-when-tab-becomes-visible/23487/5 "2021-02-26T23:29:26Z")

</div>

Sounds like what the clerks have been reporting to me. Curious 😂
