T
TanStack12mo ago
correct-apricot

useBlock is the best approach for this use-case?

I have a 1 page SPA. From the url, the user always, come with queryParameters example internetPlanId=1&mobilePlanId=4 In the UI we populate selections based on those parameters. Then, the user needs to fill out the form, do some selections more and submit an order. If order success, we push the user to the /confirmation page. I need users to prevent from going to /confirmation even if they come first to the root with params /mobilePlanId=4. Should I use useBlocker or is there any other better approach?
3 Replies
modern-teal
modern-teal12mo ago
how would a user "go to /confirmation"? by clicking a link? if yes, simply disabling that link should work
correct-apricot
correct-apricotOP12mo ago
Users that already made a previous order and got autocomplete from the browser/users that stored the url.
modern-teal
modern-teal12mo ago
a blocker would not prevent typing in /confirmation and then pressing enter. the page would still load blocker only blocks navigating via links I would differentiate between different orders on the confirmation page using an order id

Did you find this page helpful?