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

Back button handling #50

Open
preetkaran20 opened this issue Sep 25, 2021 · 6 comments
Open

Back button handling #50

preetkaran20 opened this issue Sep 25, 2021 · 6 comments
Assignees
Labels
Analysis enhancement New feature or request good first issue Good for newcomers

Comments

@preetkaran20
Copy link
Member

As VulnerableApp-Facade UI is a Single Page Application, hence there is no routing and all communication is done using Ajax hence browser history stack doesn't store any information of the navigations. under this enhancement, we need to introduce the history tied to the browser navigations such that back button navigates to the previous step.

** Solutions **
The general solution in Single page applications is adding the actions into the browser's history e.g: using history api of browser: https://developer.mozilla.org/en-US/docs/Web/API/History_API

The first solution that is coming to my mind is just add the state into the history and on back button, overwriting the state of the react.

Information about VulnerableApp-Facade code:
State interface: https://github.com/SasanLabs/VulnerableApp-facade/blob/main/facade-app/src/interface/State.tsx
Global State manipulation:

setGlobalState = (globalState: GlobalState) => {

we use react and for state management, we are not using redux, instead, we rely on parent component to expose a method that will be called by a child on state change so that other components can be updated.
The parent component is App.tsx.

@preetkaran20 preetkaran20 added enhancement New feature or request good first issue Good for newcomers Analysis Hacktoberfest labels Sep 25, 2021
@Duy-L
Copy link
Contributor

Duy-L commented Oct 31, 2021

Hi, I would like to try this.

@preetkaran20
Copy link
Member Author

Hi @Duy-L,

Great, I have assigned the issue to you.

thanks,
Karan

@preetkaran20
Copy link
Member Author

Hi @Duy-L ,

Are you still working on this issue?

@Dripcoding
Copy link
Contributor

Dripcoding commented Apr 2, 2022

React has a feature called Context that can handle global state management if an external library like Redux would be overkill. Using Context and React hooks would organize how state is managed and is better for maintainability.

https://reactjs.org/docs/context.html

@amrendranath
Copy link
Contributor

@Dripcoding Shall I work on this?

@preetkaran20
Copy link
Member Author

@amrendranath yes, please go ahead on this.

thanks,
Karan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Analysis enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants