Repository navigation
fix: delete model text #7946
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
Merged
+12
−11
Merged
fix: delete model text #7946
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
Review of the diff
Potential issues
Empty string instead of
undefinedIf
MsgConfirm's second parameter is rendered unconditionally (e.g., a subtitle<p>), an empty string can produce an empty node / extra spacing, and truthiness checks insideMsgConfirmwill treat''as "no message" by accident. Preferundefined:Type safety of
resource_countEnsure the model type used by
props.modelactually declaresresource_count(and that the list/detail API always returns it). Otherwise this is a compile error or a silentundefined→ always-empty warning.i18n pluralization
countis special in vue-i18n. Make suremodel.delete.referencedhas plural forms (e.g.,... | ...) in all locale files, and that the call uses the plural form, e.g.t('model.delete.referenced', { count }, count)(ortc). If a locale is missing the key, users will see the raw key.Missing error handling (pre-existing, but worth fixing)
The chain has no
.catch().MsgConfirmrejects on cancel anddeleteModelrejects on API failure → unhandled promise rejection. Also, if the server rejects the deletion because the model is referenced, the user only sees a generic failure. Consider catching and showing a specific error, or disabling/replacing the delete action whenresource_count > 0.Stale
resource_countThe count comes from data loaded earlier; it may be out of date by the time the dialog opens. Don't rely on it for correctness — keep the server-side guard as the source of truth.
Message clarity
model.delete.referencedshould state the consequence explicitly (resources will be detached / deletion will fail), not just "N resources reference this".Formatting
The one-line options object is long; run Prettier/ESLint to keep it consistent with repo style. The change also adds a line, so consider whether the diff noise (re-wrapping the whole call) is worth it.
Readability / optimization suggestion
Flatten the nested
.then()and useasync/awaitwith explicit handling:Quick checklist
resource_countexists in the type and API payloadmodel.delete.referencedadded to every locale, with plural formsundefined(not'') when count is 0/missing