Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/blaze-hot/update-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ let templateViewPrefix = 'Template.';
// Overrides the default _applyHmrChanges with one that updates the specific
// views for modified templates instead of updating everything.
Template._applyHmrChanges = function (templateName = UpdateAll) {
// Integration with Blaze Error Indicator:
// When templates are updated via HMR, clear any related errors.
// This provides a better developer experience by automatically
// clearing "No such template" errors when the missing template is added.
if (typeof Blaze !== 'undefined' && Blaze._errorIndicator) {
if (templateName === UpdateAll) {
// Full update: clear all errors since the entire view tree is refreshed
if (typeof Blaze._errorIndicator.clearAll === 'function') {
Blaze._errorIndicator.clearAll();
}
} else {
// Targeted update: only clear errors related to this specific template
if (typeof Blaze._errorIndicator.removeTemplateError === 'function') {
Blaze._errorIndicator.removeTemplateError(templateName);
}
}
}

if (templateName === UpdateAll || lastUpdateFailed) {
lastUpdateFailed = false;
clearTimeout(timeout);
Expand Down
23 changes: 23 additions & 0 deletions packages/blaze/blaze.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,28 @@ declare module 'meteor/blaze' {
function toHTML(templateOrView: Template | View): string;

function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;

/**
* Enable or disable the visual error indicator for Blaze errors.
* @param enabled Whether to enable the error indicator (default: true)
*/
function showErrorIndicator(enabled?: boolean): void;

/**
* Clear all errors from the error indicator.
*/
function clearErrors(): void;

/**
* Get the current list of Blaze errors.
* @returns Array of error objects
*/
function getErrors(): Array<{
id: number;
message: string;
error: string;
stack: string;
time: string;
}>;
}
}
Loading
Loading