You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the main branch has an array that save all previous footsteps. Then, when you can the back button it decrements the array and updates all usestates as you can see in this function
This is not ideal because if a the server crash, you will lose all content in array, and you will no longer be able to use the back button.
We propose two solutions:
1- use the dev branch because it uses dynamic routes. Therefore when it calls router.back. route.back in nextjs is like pressing the window back button on top. Navigate back in history. Equivalent to clicking the browser’s back button. It executes window.history.back() . Then, it would actually call this function again https://github.com/BU-Spark/se-bch-als-resource-app/blob/dev/code/src/pages/question/%5Bid%5D.tsx and make all the api calls again. Therefore, nothing is saved like in the main.
2- add a prev question and prev choices field in strapi. So, whenever you press back button, it calls prev question and choices and updates the pages. This way, you are not saving anything on site and site is stateless.
You can explore more options with your dev team to find best solutions. Good luck!
The text was updated successfully, but these errors were encountered:
mernaAlghannam
changed the title
Ensure site it stateless (1st solution in dev branch, 2nd solution is proposed by tech advisor and can be used to modify code in main branch)
Ensure site it stateless (1st solution in dev branch, 2nd solution can be used to modify code in main branch)
May 15, 2023
Currently the main branch has an array that save all previous footsteps. Then, when you can the back button it decrements the array and updates all usestates as you can see in this function
se-bch-als-resource-app/code/src/pages/QuestionairePage.tsx
Line 102 in 6f803e0
This is not ideal because if a the server crash, you will lose all content in array, and you will no longer be able to use the back button.
We propose two solutions:
1- use the dev branch because it uses dynamic routes. Therefore when it calls router.back. route.back in nextjs is like pressing the window back button on top. Navigate back in history. Equivalent to clicking the browser’s back button. It executes window.history.back() . Then, it would actually call this function again https://github.com/BU-Spark/se-bch-als-resource-app/blob/dev/code/src/pages/question/%5Bid%5D.tsx and make all the api calls again. Therefore, nothing is saved like in the main.
2- add a prev question and prev choices field in strapi. So, whenever you press back button, it calls prev question and choices and updates the pages. This way, you are not saving anything on site and site is stateless.
You can explore more options with your dev team to find best solutions. Good luck!
The text was updated successfully, but these errors were encountered: