-
Notifications
You must be signed in to change notification settings - Fork 24
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
Auto save changes in sharing modal #6314
Conversation
I am unsure how to communicate to the user, that the settings were automatically updated 🤔. I tried a spinner and disabling the "ok" button but the update is just too fast for the spinner to be visible long enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, but I noticed a couple of things during testing:
- When the annotation is set to "internal", opening the modal will also immediately show a toast (only when opening the modal for the first time, as the modal is rendered lazily and won't be destroyed when closing it).
- There can only be one instance of the success toast. When switching fast between the settings, no new toast will appear (--> therefore, one could wonder if it was really saved). I suggest to decrease the time for how long the toast will be there and ensure somehow that the toast can be there multiple times (maybe assign a random key to the toast?).
- Switching to "Private" won't show a toast (I think the toast comes from updating the teams, but this isn't done when setting to "Private").
- There is a race condition when changing the visibility very fast. I somehow managed to get an error that the teams cannot be updated. Probably, the frontend thought that the annotation is "public" and tried to update the teams, but the back-end still had the annotation set to "private".
HI @philippotto, I am currently working on your feedback.
What would you suggest to circumvent this race condition? freeze / disable the modal until the changes are applied in the backend? I think this would only be necessary for the visibility setting and not for the team setting, correct? Changing selected teams should not lead to this race condition. Therefore I would suggest disabling the visibility setting while a backend update call is still in process 🤔. What do you think? |
Yes, I think that's fair.
Could very well be, but I think it's easier to just always block the view to avoid any problems if these dependencies change in the future. In most cases, the blocking shouldn't even be noticeable to the user. |
It is only slightly noticeable 👍. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, works great 👍 however, the share modal changed on the master branch (a new boolean setting was added), which needs to be incorporated now :)
frontend/javascripts/oxalis/view/action-bar/share_modal_view.tsx
Outdated
Show resolved
Hide resolved
@philippotto I just applied your feedback 🌮. Thanks for informing me that another setting was added to the sharing modal on the master. This made it easier to understand how to resolve the merge conflicts. This pr is ready for your second review 🏁 |
Thanks for fixing this! Was the bug introduced recently (e.g, with the allow-contributors-to-modify change) or has it been like this for a while? Could you point to the line changes where you fixed this? |
Oh, maybe I misformualted my previous message. The truth is: I introduced this bug with this pr and noticed it only pretty late 😅. That's why I wanted to make sure that this bug does not make it to production by asking you to also specifically checking the fix. |
Nice! Seems to work great :) I noticed two minor things which should be changed:
|
…m:scalableminds/webknossos into modal-auto-save
… into modal-auto-save
Thanks for finding this. I now ensure that upon a failed update request an error is shown to the user, the UI resets its state prior to the failure so that it matches what's currently saved in the backend and it is always reenabled. For additional information, the error is logged to the console.
👍 Done 🍡 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent 💯
This PR automatically saves settings / content of a modal. Therefore it is no longer required to explicitly hit "Save". As already stated in #5074, this makes sense for the sharing modal. Another modal is not mentioned, and I could not find another one where it makes sense to me to save the current input automatically.
The original issue #5074 mentioned checking all modals to whether auto-saving is useful in that case. On a rough look, I could not find a modal that would benefit from auto-saving (search the codebase for all files having modal in their name).
If you can think of another modal, just tell me and I'll add it here.
URL of deployed dev instance (used for testing):
Steps to test:
Issues:
(Please delete unneeded items, merge only when none are left open)