mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: edit assignment flickering when dragged and dropped
After some testing, I found that assignmentUUID isn't necessary for the conditional render. After some testing in a race condition environment (two clients) the activity itself as a condition is enough and it doesn't seem that its worth having assignmentUUID as well.
This commit is contained in:
parent
53bae7cbb3
commit
4afa1d4458
1 changed files with 4 additions and 3 deletions
|
|
@ -281,7 +281,7 @@ const ActivityElementOptions = ({ activity }: any) => {
|
||||||
const session = useLHSession() as any;
|
const session = useLHSession() as any;
|
||||||
const access_token = session?.data?.tokens?.access_token;
|
const access_token = session?.data?.tokens?.access_token;
|
||||||
|
|
||||||
async function getAssignmentUUIDFromActivityUUID(activityUUID: string) {
|
async function getAssignmentUUIDFromActivityUUID(activityUUID: string): Promise<string | undefined> {
|
||||||
const activity = await getAssignmentFromActivityUUID(activityUUID, access_token);
|
const activity = await getAssignmentFromActivityUUID(activityUUID, access_token);
|
||||||
if (activity) {
|
if (activity) {
|
||||||
return activity.data.assignment_uuid;
|
return activity.data.assignment_uuid;
|
||||||
|
|
@ -291,7 +291,8 @@ const ActivityElementOptions = ({ activity }: any) => {
|
||||||
const fetchAssignmentUUID = async () => {
|
const fetchAssignmentUUID = async () => {
|
||||||
if (activity.activity_type === 'TYPE_ASSIGNMENT') {
|
if (activity.activity_type === 'TYPE_ASSIGNMENT') {
|
||||||
const assignment_uuid = await getAssignmentUUIDFromActivityUUID(activity.activity_uuid);
|
const assignment_uuid = await getAssignmentUUIDFromActivityUUID(activity.activity_uuid);
|
||||||
setAssignmentUUID(assignment_uuid.replace('assignment_', ''));
|
if(assignment_uuid)
|
||||||
|
setAssignmentUUID(assignment_uuid.replace('assignment_', ''));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -324,7 +325,7 @@ const ActivityElementOptions = ({ activity }: any) => {
|
||||||
</Link>
|
</Link>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{activity.activity_type === 'TYPE_ASSIGNMENT' && assignmentUUID && (
|
{activity.activity_type === 'TYPE_ASSIGNMENT' && (
|
||||||
<>
|
<>
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue