designsystemsinternational / mechanic

Mechanic is a framework to build assets built on web code.
https://mechanic.design
MIT License
251 stars 11 forks source link

Cache Remains and Crash the New Project #133

Open munusshih opened 2 years ago

munusshih commented 2 years ago

Describe the bug The new project might constantly crash and the whole site will go blank if you try to interact with it. This is probably caused by the remaining local storage cache. Since you have opened another project and interacted with the sidebar before in the custom preset, it remembers the cache will crash your new project that has the same project name or function name (unsure) if the parameters don't match.

To Reproduce Steps to reproduce the behavior:

  1. Go create and run dev for any project using the default project name and function name
  2. Play with its sidebar in the custom preset
  3. Close this first project
  4. Now create another project using the default project name and function name in a different folder
  5. Play with its sidebar in the custom preset
  6. See the error

Expected behavior The site will go completely blank with error messages in the console stating that some of the sidebar values are null

Screenshots

https://user-images.githubusercontent.com/34775424/170353166-72d7e02a-55e4-41d9-bf0c-9fe9ee5a7e77.mov

Desktop (please complete the following information):

Additional context Local Cache Memory Related.

fdoflorenzano commented 2 years ago

Hey @munusshih ! Could you please share at least part of the erros stacks that you get with this?

Also, I think you added the incorrect video.

fdoflorenzano commented 2 years ago

@munusshih I was able to recreate an error. Not with the DSI logo maker though, but with same named functions in different projects. Can you specify the name of the functions you interacted with in DSI logo maker and in the new project? Because from what I remember, the name of functions should be enough to tell local storage apart. If they are called differently, maybe the issue was with another project, or it's another issue all together.

munusshih commented 2 years ago

@fdoflorenzano Thanks for pointing that out. Lemme update my post.

munusshih commented 2 years ago

No come to think of it I name all of them with the default project name my-project and default function name my-function but in different folders. Maybe that's why?

fdoflorenzano commented 2 years ago

@munusshih Unless you also find that somehow using the DSI maker project before affected the run, it may be just that. If you can post the error stack in a comment either way, I would appreciate it.

munusshih commented 2 years ago

I've done some different combinations and surprisingly was unable to recreate the error even with the same function name in different folders.... but these are the error stacks

lucasdinonolte commented 2 years ago

This could really be about the same function name. The function name is used to generate the params' cache key in localStorage. So you could run in situations where mechanic loads an incompatible version of the cached params into a function that has the same name as the function that cached those values.

If this is the cause of this #140 should fix it 😊