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: broken onDestroy on navigation #2880

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

mstrasinskis
Copy link
Contributor

@mstrasinskis mstrasinskis commented Jul 13, 2023

Motivation

Reverting layout based fix for missing onDestroy after disbursing sns neuron (more info)

PRs

Revert PR #2865

Changes

  • apply the workaround from the wallet page to all detail pages.
  • set local to global animation flag

Tests

Tested manually

- reverting because the switching to |local breaks introend event
Copy link
Member

@peterpeterparker peterpeterparker left a comment

Choose a reason for hiding this comment

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

Thanks!!!

@mstrasinskis mstrasinskis added this pull request to the merge queue Jul 13, 2023
Merged via the queue into main with commit cfa37ae Jul 13, 2023
@mstrasinskis mstrasinskis deleted the revert-layout-based-ondestroy-fix branch July 13, 2023 18:06
github-merge-queue bot pushed a commit that referenced this pull request Jul 17, 2023
# Motivation

When a Sns neuron is successfully disbursed, the modal in which the
action is triggered is closed and the user is automatically redirected
to the list of neurons. As a result, we noticed that the page and
components `onDestroy` were not called. We fixed the issue by adding a
guard at the top of the layout.

Today I debugged the issue again and figured out that the root cause of
the particular issue was the fact that the navigation was executed
before the dispatcher that closes the modal was triggered.

I couldn't replicate the issue with a sample repo but, by inverting both
order, can solve the issue.

# Notes

This PR does not remove the guard. Only fix the particular issue in case
we would remove it in the future.

# PRs

Follow-up various PR but, last is #2880

# Changes

- invert `goto` and `dispatch("nnsClose")`
github-merge-queue bot pushed a commit that referenced this pull request Jul 25, 2023
# Motivation

Implementing the workaround for `onDestroy` at the top level of the
`+layout` of the detail pages (PR #2880) had for side effect to make the
navigation callbacks of its pages/layouts to not being called. As those
are not called, the dapp is not able to determine which was the
`referrer` of these pages and per extension, to effectivelly use the
referrer in back action.

Long story short, on mainnet, navigation from the "Launchpad" to a
"Proposal" and clicking back lead the users to "Proposals" page instead
of going back to "Launchpad".

# Changes

- refactor workaround in a dedicated component `LayoutNavGuard`
- use component within the layouts
- remove top layout as unused

# Notes

I noticed a type in the CHANGELOG and since I was already there, I also
improved the communication of the fix #2950 which is not related to this
PR.
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.

2 participants