-
Notifications
You must be signed in to change notification settings - Fork 81
New design implemented for Announcements page #2279
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
base: v4-student-dashboard
Are you sure you want to change the base?
Conversation
| // Setup delete mutation | ||
| this.deleteMutation = this.query.useMutation(this.deleteAnnouncement, { | ||
| onSuccess: () => { | ||
| window.TutorCore.modal.closeModal('tutor-announcement-delete-modal'); |
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.
Define a const for the modal ID.
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.
Can we use these to the php template?
| // Update reactive object props instead of replacing it to maintain bindings | ||
| Object.keys(this.values).forEach((key) => delete this.values[key]); | ||
| Object.assign(this.values, values); | ||
| } else { | ||
| this.values = Object.keys(this.fields).reduce( | ||
| const defaultValues = Object.keys(this.fields).reduce( | ||
| (acc, name) => { | ||
| acc[name] = this.fields[name].defaultValue; | ||
| return acc; | ||
| }, | ||
| {} as Record<string, unknown>, | ||
| ); | ||
| Object.keys(this.values).forEach((key) => delete this.values[key]); | ||
| Object.assign(this.values, defaultValues); |
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.
Please explain what was the issue
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 reset() Bug (Crucial for Alpine)
In the original code, reset() replaces the entire this.values object. In Alpine.js, this often breaks live bindings. If an input field is bound to values.title, and you replace the values object itself, that input sometimes "loses" its connection to the new object.
Recommendation: Use Object.assign() to update the object's properties instead of replacing the object.
No description provided.