Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

fix: stale session ids being displayed in the attach to session dropdown #1727

Conversation

huzaifaiftikhar
Copy link
Contributor

  1. Attach to session placeholder text enterYourSessionId was not getting displayed as we were setting the value to '' in case there are no running sessions, however, the antd expects this value to be undefined instead. For reference check this stackoverflow link.
  2. Whenever the GET_SESSIONS_DONE event is received for the first time we set the attachSessId inside the state variable, however, for the subsequent occurrences of this event we never update the state.attachSessId as we had already set that once initially. This leads to stale sessions that are not running anymore and still getting listed. This stale entry is only removed if the user selects a valid entry from the dropdown so that the SET_ATTACH_SESS_ID event is triggered which updates the value of state.attachSessId, however, there could be scenarios where there are no running sessions anymore and therefore in this situation, there's no way to to get rid of this stale entry.
  3. To fix the above issue I have created a method isAttachSessIdValid that validates whether the existing value of state.attachSessId is any more valid or not? If it's not valid then we update its value with the currently running session id. If there are no running sessions currently then we reset the value to null (which is the initial state) so that the placeholder text starts getting displayed.

@KazuCocoa KazuCocoa self-requested a review March 9, 2021 22:46
@KazuCocoa KazuCocoa merged commit 03601e7 into appium:1.20 Mar 15, 2021
@huzaifaiftikhar huzaifaiftikhar deleted the fix_placeholder_text_and_stale_attach_session_id branch March 15, 2021 05:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants