Skip to content

Make deepLinking dynamic #4781

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

Closed

Conversation

sal-pal
Copy link

@sal-pal sal-pal commented Aug 2, 2018

Fixes #3958

After clicking a deepLink, a tag or operation is shown and scrolled to without needing to refresh the page.

This is achieved by the following:

  • To update the hash with a deepLink's path, the markdown component removes target=_blank from all anchors having #/ in its href value.
  • To be ready to scroll once the hash changes, the ref of each tag and operation is collected in the beginning of the app's lifecycle.
  • The deepLink's path is parsed once the hash changes, which is then used to show the target, as well as access its ref for scrolling.

@shockey shockey mentioned this pull request Aug 3, 2018
@sal-pal sal-pal changed the title Ft/3958 make deepLinking dynamic Make deepLinking dynamic Aug 3, 2018
@sal-pal sal-pal force-pushed the ft/3958-make-deeplinking-dynamic branch from ee8980c to eeddbda Compare August 3, 2018 17:22
sal-pal added 3 commits August 9, 2018 14:16
In order for Swagger-UI to scroll immediately after a deepLink is clicked, each tag and operation's ref is collected in the beginning of the app's lifecycle.
This is done by making the markdown component remove `target=_blank` from each anchor that has an href value starting with `#/`.
@sal-pal sal-pal force-pushed the ft/3958-make-deeplinking-dynamic branch from a2f1a3f to 7f80bb5 Compare August 9, 2018 18:40
Copy link
Contributor

@shockey shockey left a comment

Choose a reason for hiding this comment

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

Hi @srpalomino! I identified regressions which need to be addressed before this can move forward to a full review.

Using the configuration ?url=http://petstore.swagger.io/v2/swagger.json&deepLinking=true:

  1. expanding a tag or operation no longer updates the URL fragment
  2. reloading the page with the fragment #/pet no longer scrolls to the correct tag
  3. reloading the page with the fragment #/pet/addPet no longer scrolls to the correct operation

@shockey
Copy link
Contributor

shockey commented Mar 8, 2020

closing due to inactivity.

happy to consider this again if the requested changes are taken care of — just open a new PR and we'll pick it back up!

@shockey shockey closed this Mar 8, 2020
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.

DeepLinking onClick does not scroll or open Operation.
2 participants