Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Don't ask user to run in background on restart after clicking upgrade #1596

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

maparr
Copy link
Contributor

@maparr maparr commented Nov 27, 2023

Partially closing #1457.

How to test:

  1. Need to clone the repository and use Windows ( we have vm, ask me if needed ), follow the guide
  2. change package.json line, for now 1.2.6 is ok. In case we want to test force update, need to update to 1.2.5
  3. Run yarn package-win
  4. Get the exe file in the release folder, in the repo source
  5. install and enjoy 🌴 🍸

@maparr maparr self-assigned this Nov 27, 2023
@maparr maparr changed the title chore: add debug information for the update and restart modal Fix: Don't ask user to run in background on restart after clicking upgrade Nov 27, 2023
Copy link

Compiled Binaries

@brusherru
Copy link
Member

@pigmej do we still want to have a forced update feature?
I guess yes, then @maparr please make sure it still works and does not ask the User to update now or later — otherwise, this feature won't work.

Copy link

github-actions bot commented Dec 1, 2023

Compiled Binaries

Copy link

Compiled Binaries

Copy link

Compiled Binaries

Copy link

Compiled Binaries

Copy link

Compiled Binaries

Copy link

Compiled Binaries

@maparr maparr force-pushed the fix/1457 branch 3 times, most recently from 813165c to b32ea3c Compare December 20, 2023 13:18
@spacemeshos spacemeshos deleted a comment from github-actions bot Dec 20, 2023
@spacemeshos spacemeshos deleted a comment from github-actions bot Dec 20, 2023
Copy link

Compiled Binaries

Copy link

Compiled Binaries

@maparr maparr marked this pull request as ready for review December 20, 2023 15:11
Copy link
Collaborator

@monikasmolarek monikasmolarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that I have not yet tested the functionality, please assess whether or not we want to check proactively the node's and network's state to inform the users more about the consequences (lost a few layers, the whole epoch, etc.)

Comment on lines 41 to 58
<Message>
<p>
Restarting now is <b>CRITICAL</b> and may impact your node’s
performance and rewards.
</p>
<ul>
<li>
Click <b style={{ color: smColors.green }}>RESTART NOW</b> to apply
the update immediately. Delaying the update could result in
potential loss of rewards.
</li>
<li>
Click <b style={{ color: smColors.purple }}>POSTPONE</b> to delay
the update. Be aware that postponing may slow down your node’s
performance and future rewards.
</li>
</ul>
</Message>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be incorrect. @brusherru please correct me if I'm wrong.

  • The loss of the rewards might be caused by restarting (if the node is supposed to publish a proposal at this particular time) and not caused by the fact that the user updates immediately or a couple of hours later.

  • Postponing the restart(and upgrade) should not have such a big impact on the node's performance, not to the extent that the user should risk losing rewards to update immediately. If there are any breaking changes in the code affecting significantly the node's performance and network compatibility (and thus missed rewards) then the forced update is supposed to be used (so no choice for the user anyway, no need to display any modal).

From the grammatical perspective, it's confusing and quite misleading in several aspects.

Additionally, smapp "knows" the current layer and the number of layers for which the node has rewards eligibility. So as Lane suggested, it would be great to display it only when applicable. There might be users not even smeshing or still generating the POS data. If they see the missed rewards warning they will get lost and scared.
But, we need to also remember about not restarting while publishing ATX and preparing the proof...

If it's too complex and time-consuming for this version, then my suggestion would be:

Suggested change
<Message>
<p>
Restarting now is <b>CRITICAL</b> and may impact your node’s
performance and rewards.
</p>
<ul>
<li>
Click <b style={{ color: smColors.green }}>RESTART NOW</b> to apply
the update immediately. Delaying the update could result in
potential loss of rewards.
</li>
<li>
Click <b style={{ color: smColors.purple }}>POSTPONE</b> to delay
the update. Be aware that postponing may slow down your node’s
performance and future rewards.
</li>
</ul>
</Message>
<Message>
<p>
To finalize the update, Smapp must be restarted. However, verify your eligibility for upcoming layer rewards. Powering off the node risks missing proposal submissions and losing the rewards.
</p>
<ul>
<li>
Click <b style={{ color: smColors.green }}>RESTART NOW</b> to apply
the update immediately.
</li>
<li>
Click <b style={{ color: smColors.purple }}>POSTPONE</b> to delay
the update. The persistent "restart" button will remind you about the pending update.
</li>
</ul>
</Message>

Please note that I have not yet tested the functionality, please assess whether or not we want to check proactively the node's and network's state to inform the users more about the consequences (lost a few layers, the whole epoch, etc.)

@maparr
Copy link
Contributor Author

maparr commented Dec 21, 2023

If this adds more clutter to the application. I removed the modal window. In the PR, I removed the dialog prompt to close the application. And let’s partially solve the problem in the task. If possible, the details described in the task and in the PR will remain. Which, if possible, will be added.

Copy link

Compiled Binaries

@monikasmolarek
Copy link
Collaborator

Ok so if it's only about removing the modal for the updates, then it's ok, it works as expected.
But I think we shouldn’t close issue #1457 then.

Copy link
Member

@brusherru brusherru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message proposed by Monika is perfect and it will be good to have it (as described in the issue).

However, I'd like to keep it simple:

  1. Avoid making the Version component stateful
  2. Avoid having $isUpdateInProgress in so many places, just for not showing the prompt (are there any problems with canceling installation by choosing the "Cancel" option in the quit prompt?)
  3. I'd like to keep using the system prompt (as it is already implemented)

So I think it can be simplified to calling managers.smeshing.isSmeshing and then displaying a standard prompt or a special one. It will also leave us a space to easily (without a lot of refactoring) add any special conditions.
And managers are already passed into promptBeforeClose.

@maparr
Copy link
Contributor Author

maparr commented Dec 28, 2023

Okay, I can finally summarize my understanding:

I'm currently unable to simply use the system modal and manage it effortlessly (I don't see the option right now). I'm looking into how the install and restart function operates:

Screenshot 2023-12-28 at 14 01 38

As observed, the process first triggers the closure of all windows and then the before-quit event.

I'm also examining how this exit process functions on different operating systems:

  1. macOS: A system prompt is displayed.
  2. Windows: The prompt appears but lasts for less than a minute.
  3. AppImage Ubuntu: The application closes as quickly as possible without any prompt.
  4. .deb (Ubuntu): This version lacks the auto-download and install feature.

By this result, we can show the system modal, but it will be more difficult than the client solution.

Furthermore, I don’t see a straightforward way to simplify this in the current code base. Other companies/repositories either move all modals to the FE or trigger the result as a global variable, which I don't prefer. However, I'm open to exploring some creative solutions.

Copy link

Compiled Binaries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants