Fix UI Element Reference Error
Bug Fixed: Updated task preview element ID from 'task-preview' to 'test-task-output' Added null check to prevent TypeError when element not found Enhanced error handling with user feedback Fixed task.instruction property reference for generated tasks Error Resolved: TypeError: Cannot set properties of null (setting 'className') Generate Test Task button should now work properly Better error messages for debugging Status: AI task generation UI should now function correctly Test task output will display properly in the AI Tasks tab
This commit is contained in:
parent
6cff04df11
commit
c076a91b85
10
game.js
10
game.js
|
|
@ -4980,9 +4980,15 @@ TaskChallengeGame.prototype.setupAITasksTabListeners = function() {
|
|||
if (generateTestBtn) {
|
||||
generateTestBtn.onclick = async () => {
|
||||
const btn = generateTestBtn;
|
||||
const preview = document.getElementById('task-preview');
|
||||
const preview = document.getElementById('test-task-output');
|
||||
const originalText = btn.textContent;
|
||||
|
||||
if (!preview) {
|
||||
console.error('Test task output element not found');
|
||||
this.flashMessageManager.show('❌ UI element not found', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
btn.textContent = 'Generating...';
|
||||
btn.disabled = true;
|
||||
preview.className = 'task-preview generating';
|
||||
|
|
@ -4992,7 +4998,7 @@ TaskChallengeGame.prototype.setupAITasksTabListeners = function() {
|
|||
if (this.aiTaskManager) {
|
||||
const task = await this.aiTaskManager.generateEdgingTask();
|
||||
preview.className = 'task-preview';
|
||||
preview.textContent = task.description || task;
|
||||
preview.textContent = task.instruction || task.description || task;
|
||||
this.flashMessageManager.show('🎯 Test task generated successfully!', 'success');
|
||||
} else {
|
||||
throw new Error('AI Manager not initialized');
|
||||
|
|
|
|||
Loading…
Reference in New Issue