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

Switch to root folder if current folder cannot be loaded #7669

Merged
merged 4 commits into from
Mar 7, 2024

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Mar 6, 2024

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • create a new folder
  • yarn refresh-schema
  • reload page

Issues:


(Please delete unneeded items, merge only when none are left open)

@philippotto philippotto requested a review from fm3 March 6, 2024 13:50
@philippotto philippotto self-assigned this Mar 6, 2024
@fm3
Copy link
Member

fm3 commented Mar 6, 2024

I’m afraid this doesn’t quite work for me yet 😬 It looks like some folders briefly flash but then it switches to the blank version again after a few ms. Does it work for you, did you test with refresh-schema? I don’t know what’s different, maybe it’s a firefox vs chrome thing? 🤔

@philippotto
Copy link
Member Author

I’m afraid this doesn’t quite work for me yet 😬 It looks like some folders briefly flash but then it switches to the blank version again after a few ms. Does it work for you, did you test with refresh-schema? I don’t know what’s different, maybe it’s a firefox vs chrome thing? 🤔

Initially, I simply tried localStorage.setItem("sample@scm.io-sample_organization-activeFolderId", "65e871d4ec0000dc04353aee") and then reloaded the page. That worked even on master. Then, I tried yarn refresh-schema which was problematic. With my fix, a simple reload worked. However, something might have changed inbetween.
Maybe the folder hierarchy is cached internally and if that cache is outdated, the switch to the root doesn't work.
I'll look into it again 🤷

It's a bit annoying to test since refreshing the schema takes so long. Do you know whether there is a faster way to clear the folders?

@fm3
Copy link
Member

fm3 commented Mar 6, 2024

I’m afraid manually editing folders in the DB is not going to be simpler or faster than yarn refresh-schema :/

@philippotto
Copy link
Member Author

philippotto commented Mar 7, 2024

Please try again! I think it already worked before, but there was quite a bit of a delay until the switch would happen. The active folder is fetched and if that fails, it is retried three times. Due to an exponential back off in the delay time (default of react-query), this took at least 6 seconds. Now, it's down to 1.5s. I hope this wait is acceptable :)

By the way, deleting the rm -f target/scala-2.13/src_managed/schema/com/scalableminds/webknossos/schema/Tables.scala bit from yarn refresh-schema helped a bit to get feedback faster :)

@fm3
Copy link
Member

fm3 commented Mar 7, 2024

Yes, seems to work now, this is great! One more tiny thing: could the error toast saying »could not find the requested folder« also vanish after some seconds? If that would be simple, I’d appreciate it, otherwise this change as it is also helps me a lot already :)

@philippotto
Copy link
Member Author

Unfortunately, it's not trivial :S

@philippotto philippotto enabled auto-merge (squash) March 7, 2024 13:56
@philippotto philippotto merged commit b59086e into master Mar 7, 2024
2 checks passed
@philippotto philippotto deleted the switch-to-root-folder-when-error branch March 7, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When dashboard localstorage points to deleted folder, go to root instead
2 participants