-
Notifications
You must be signed in to change notification settings - Fork 55
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
Edit scheduleEntry on activity view without redirection problem #4975
base: devel
Are you sure you want to change the base?
Edit scheduleEntry on activity view without redirection problem #4975
Conversation
4ad1317
to
3fe670b
Compare
2569d56
to
88040c3
Compare
88040c3
to
f1a84b6
Compare
✅ Feature branch deployment ready!
|
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.
Looks pretty good.
Is robust, even switches the day when you switch the day of the currently displayed scheduleentry.
but if someone else deletes the scheduleEntry you currently display, and then you press "Submit" (or aktualisieren), then it ends in an infinite loop. But it works if you navigate to a scheduleEntry which was deleted.
maybe you need one + renavigation more.
I don't understand. Wasn't this a problem before? For that we would probably need a callback on the entity, that triggers on deletion. |
No before, this lead to a 404. (which is correct i think) |
@BacLuc so how would you fix this? Do you think this is a big issue? |
You could catch the 404 for the not existing scheduleentry and change the route to an error page. |
@BacLuc it works now. I just check each scheduleEntry patch. If the request returns 404 and it is the current one, we redirect to an existing one. |
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<DialogActivityEdit | ||
v-if="activity && isContributor" |
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.
shouldn't scheduleEntry be here, when its used as a prop?
apiStore | ||
.get() | ||
.scheduleEntries({ id: to.params.scheduleEntryId }) | ||
._meta.load.then(() => { |
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.
minor: i find it a little silly that you mix the await syntax with then
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.
I find it perfectly valid in use cases where writing it with only await would be more complicated, especially when you have to use then
and catch
at the same time (which would translate to await
with a try {} catch {}
block). In particular, I think then
is more useful and readable when you have to continue working with a promise (e.g. when chaining multiple transformations or steps), while await
is useful when you are only interested in the result payload of the promise.
Regardless of code style preferences, we have this mixed syntax already in various places in the frontend as well as in hal-json-vuex.
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.
I don't understand it fully but something doesn't quite add up in the "browser back when previous schedule entry deleted" case: it finds another scheduleEntry of the activity, but some data is not refreshed properly. See screenshot where the title and time slot matches with a green LS entry but the badge says blue LP.

Now we have a better fallback for wrong/missing ids for activities and scheduleEntries. If a scheduleEntry is not found, but the activity is found, we load the first occurring scheduleEntry of the activity. If for whatever reason we can't find the activityId, then we try to find it using the scheduleEntryId.
This now also works if we navigate from scheduleEntry A to scheduleEntry B, then delete scheduleEntry A and use the browser back. Before this would just display our 404.
Replaces #4500