Skip to content

Conversation

@sazedul-haque
Copy link
Collaborator

No description provided.

@sazedul-haque sazedul-haque added the 4.0.0 Tutor v4.w0w label Dec 26, 2025
@sazedul-haque sazedul-haque changed the base branch from 4.0.0-dev to v4-student-dashboard December 26, 2025 06:32
// Setup delete mutation
this.deleteMutation = this.query.useMutation(this.deleteAnnouncement, {
onSuccess: () => {
window.TutorCore.modal.closeModal('tutor-announcement-delete-modal');
Copy link
Collaborator

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.

Copy link
Collaborator Author

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?

Comment on lines +531 to +543
// 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);
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0.0 Tutor v4.w0w

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants