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

Strange behaviour of onClick navigation prop of a Button #3535

Closed
prakhargupta1 opened this issue May 9, 2024 · 4 comments
Closed

Strange behaviour of onClick navigation prop of a Button #3535

prakhargupta1 opened this issue May 9, 2024 · 4 comments
Labels
bug 🐛 Something doesn't work

Comments

@prakhargupta1
Copy link
Member

prakhargupta1 commented May 9, 2024

Steps to reproduce

Video from v0.1.55

Screen.Recording.2024-05-09.at.2.13.29.PM.mov

After navigating to another page, on clicking the browser back button:

  • the app goes to preview mode.
  • and back in the edit mode, the original button disappears.

Search keywords: button

@prakhargupta1 prakhargupta1 added the bug 🐛 Something doesn't work label May 9, 2024
@Janpot
Copy link
Member

Janpot commented May 21, 2024

Toolpad doesn't create history entries when switching between pages. So when you click the back button after switching a page, it goes back to wherever you were before. If you were on the preview page before, it will go back to that preview. The reason is that since undo/redo also takes into account switching views it gets too close intertwined with the back button. I don't believe we don't have as much control as we want over the history stack to really deal with the corner-cases. So switching pages is a history replace, not a history push. We could make this more intuitive by making the page name a query parameter instead, e.g. /prod/editor/app?page=myPage

Regarding the disappearing button, there seems to be going something wrong on your end when saving the project:
Screenshot 2024-05-21 at 11 40 04

This is a different issue, if you still experience this, can you create a reproduction and open a new ticket?

@prakhargupta1
Copy link
Member Author

prakhargupta1 commented May 27, 2024

Thanks for the elaborate explanation, now I see why is it happening. We can keep it like this for now.

About the error during saving, it is happening only for this app. I recloned the repo, closed all node processes, ran tools-public app with pnpm i and pnpm run dev commands. When I drag a button I see that there is error while saving. I don't know what could be causing this, I also restarted the system.

@Janpot
Copy link
Member

Janpot commented May 27, 2024

If this is mui-public, then you're likely running into this problem: #3066
To fix this go to the root of mui-public and run yarn.

For the future, best to include an exact reproduction, a video isn't very useful on its own. Share code, or a github link to a repository with a reporduction, or even a zip file with a Toolpad project. Together with exact reproduction steps this will help maintainers to reproduce the issue with as little effort as possible.

@prakhargupta1
Copy link
Member Author

prakhargupta1 commented May 27, 2024

To fix this go to the root of mui-public and run yarn.

This worked! Thanks.

I had a hunch that the issue was with my local setup. But I understand sharing a repository link could help isolate the problem for it to be concluded as a local issue.
I am closing this issue for now, we can see if any external user reports the back button problem in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

No branches or pull requests

2 participants