Repository navigation
fix: default psd to remind change - #8210
Merged
Merged
Conversation
shaohuzhang1
commented
Nov 27, 2026
| [() => user.userInfo?.is_edit_password, changePasswordDialogRef, () => route.meta.scope], | ||
| ([isDefaultPassword]) => { | ||
| if (isDefaultPassword === true) handleOpenChangePassword() | ||
| }, |
Contributor
Author
There was a problem hiding this comment.
No syntax-level issues in the diff, but there are a few logic/UX and timing concerns.
Potential issues
-
The dialog may be reopened or reset on every scope change
- Adding
() => route.meta.scopeto the watch sources means the callback runs wheneverroute.meta.scopechanges. - If
is_edit_password === true,handleOpenChangePassword()is called even if the dialog is already open or the user has dismissed it. - If
open()resets form state, this can overwrite user input. Makeopen()idempotent, or guard it with anisOpencheck or a “already prompted” flag.
- Adding
-
Template ref timing / stale dialog instance risk
- The watcher uses
changePasswordDialogRefas a readiness trigger, but the callback does not explicitly checkchangePasswordDialogRef.value. - With the default
flush: 'pre',route.meta.scopecan change before the DOM/template ref is updated. This can cause a no-op call or, worse, anopen()call on a stale instance during route transition. - Prefer
flush: 'post'and explicitly check the ref.
- The watcher uses
-
Scope trigger is broader than the comment suggests
- The comment says “workspace / system management switch”, but
route.meta.scopewill trigger for any change in that value, includingundefinedor future scope values. - If only workspace/system scopes should trigger, use a computed predicate or watch specific route metadata.
- The comment says “workspace / system management switch”, but
-
Possible double trigger during route transitions
- Both
route.meta.scopeandchangePasswordDialogRefcan change during the same navigation. Ifopen()is not idempotent, this can result in two open attempts.
- Both
-
Type safety for
route.meta.scope- If
RouteMetais not augmented withscope, TypeScript may complain or inferunknown. - Add a
RouteMetamodule augmentation or cast/narrow the value explicitly.
- If
Suggested adjustment
watch(
[
() => user.userInfo?.is_edit_password,
changePasswordDialogRef,
() => route.meta.scope,
],
([isDefaultPassword]) => {
if (isDefaultPassword === true && changePasswordDialogRef.value) {
handleOpenChangePassword()
}
},
{ flush: 'post' },
)And make handleOpenChangePassword() / the dialog’s open() safe to call repeatedly, e.g.:
function handleOpenChangePassword() {
const dialog = changePasswordDialogRef.value
if (!dialog || dialog.isOpen) return
dialog.open()
}Minor optimization
If the intended behavior is only “prompt once after login or once per session”, track a flag such as hasPromptedDefaultPassword instead of relying on scope changes. Otherwise, switching between workspace/system management while the default password remains unchanged will keep reopening the dialog.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
【【系统用户】用户使用默认密码MaxKB@123..登录后 没有弹出修改密码对话框】
https://www.tapd.cn/tapd_fe/45245355/bug/detail/1145245355001080421