You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new modified-content change tracking calls GetModifiedValueAsync() on every editor change, which likely triggers JS interop and transfers the full editor content frequently. This can be expensive for large markdown and may degrade typing responsiveness; consider debouncing/throttling, or tracking a “dirty” flag without fetching full content on each keystroke.
The @onkeydown:preventDefault behavior is controlled by shouldPreventDefault, but that flag is set inside the keydown handler itself, which may be too late to prevent the default action for the current key event. Validate that Enter (without Shift) does not insert a newline before sending; if it does, consider an alternative approach (e.g., always prevent default and explicitly insert newline on Shift+Enter via JS, or use a JS handler for conditional preventDefault).
The new “Show PDF” link always renders and points to /cv/{id}/pdf even when the CV might not yet be persisted (id could be 0), and several places wrap a <button> inside an <a> which can cause accessibility/interaction quirks. Consider guarding the PDF link behind an id check and using an <a class="btn ..."> instead of nesting interactive elements.
<a href="/cv/@cvEntity.Id/pdf" target="_blank">
<button class="btn btn-primary btn-sm"
disabled="@isWorking">
Show PDF
</button>
</a>
<button class="btn btn-primary btn-sm"
disabled="@isWorking"
@onclick="GenerateCvPdf">
Save PDF
</button>
@if (offer is not null)
{
<button class="btn btn-primary btn-sm ms-1"
disabled="@isWorking"
title="Adjusts CV content with AI, with user defined rules in AI Summary"
@onclick="PrepareCvContent">
Adjust with AI
</button>
}
@if (offer is not null)
{
<a class="ms-1" href="/?offerUrl=@Uri.EscapeDataString(offer.OfferUrl)">
<button class="btn btn-info btn-sm" disabled="@isWorking">Offer</button>
</a>
}
<a class="ms-1" href="/cv/edit/@cvEntity.Id">
<button class="btn btn-info btn-sm" disabled="@isWorking">
CV page
</button>
</a>
@onkeydown:preventDefault is evaluated before HandleKeyDown runs, so toggling shouldPreventDefault inside the handler won’t prevent the newline on Enter. Use a DOM onkeydown guard to preventDefault() for Enter (without Shift) while keeping the Blazor handler to send the message, and remove the now-ineffective state flag.
Why: In Blazor, @onkeydown:preventDefault cannot be toggled “within” the same key event (it’s decided before/at dispatch), so updating shouldPreventDefault inside HandleKeyDown won’t reliably stop the newline. Adding a synchronous DOM preventDefault() guard for Enter (without Shift) is a practical way to ensure the textarea doesn’t insert a newline while still allowing HandleKeyDown to call SendMessage().
Medium
Prevent navigation when disabled
Wrapping a inside an is invalid HTML and causes the link to remain clickable even when the inner button is disabled (so navigation can still happen while isWorking). Replace these with a single styled and use @onclick:preventDefault="isWorking" (plus aria-disabled) to truly block navigation when disabled.
Why: Nesting a <button> inside an <a> is invalid HTML and the link can still be navigated even if the inner button is disabled, which undermines the isWorking guard. Converting these to a single styled <a> and preventing default navigation when isWorking improves correctness and UX, though it won’t block non-click navigations (e.g., “open in new tab”).
Low
Avoid null dereference in comparison
This dereferences cvEntity.MarkdownContent even though other code treats cvEntity as nullable, which can throw at runtime. Compare against a null-safe saved value and use StringComparison.Ordinal to avoid unexpected results from culture-sensitive comparisons.
private async Task OnEditorContentChanged()
{
if (diffEditor is null)
return;
var currentContent = await diffEditor.GetModifiedValueAsync();
- _hasEditorChanges = currentContent != cvEntity.MarkdownContent;+ var savedContent = cvEntity?.MarkdownContent ?? string.Empty;+ _hasEditorChanges = !string.Equals(currentContent, savedContent, StringComparison.Ordinal);
}
private async Task<bool> HasUnsavedEditorChanges()
{
if (diffEditor is null)
return false;
var currentContent = await diffEditor.GetModifiedValueAsync();
- _hasEditorChanges = currentContent != cvEntity.MarkdownContent;+ var savedContent = cvEntity?.MarkdownContent ?? string.Empty;+ _hasEditorChanges = !string.Equals(currentContent, savedContent, StringComparison.Ordinal);
return _hasEditorChanges;
}
Suggestion importance[1-10]: 4
__
Why: The current code dereferences cvEntity.MarkdownContent even though cvEntity is treated as nullable elsewhere, so this could throw if the page lifecycle ever calls the handler before initialization. Using cvEntity?.MarkdownContent ?? string.Empty and string.Equals(..., StringComparison.Ordinal) is a safe, low-risk robustness improvement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.