Skip to content
Merged
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
2 changes: 1 addition & 1 deletion ui/src/views/document/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
<SyncWebDialog ref="SyncWebDialogRef" @refresh="refresh" />
<!-- 选择知识库 -->
<SelectDatasetDialog ref="SelectDatasetDialogRef" @refresh="refreshMigrate" />
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" />
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="getList" />
</div>
<div class="mul-operation w-full flex" v-if="multipleSelection.length !== 0">
<el-button :disabled="multipleSelection.length === 0" @click="cancelTaskHandle(1)">
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code snippet has a minor issue that doesn't significantly affect the functionality but can be optimized for clarity and maintainability:

Issue: The event handler @refresh on <GeneraRelDialog> is being bound to this.refresh, which refers to the context of GenerateRelatedDialog. If you want this reference to always refer to the parent component (since it seems like refreshing should impact all components), you could use an arrow function.

Recommendation: Change the line where GenerateRelatedDialog is declared from:

<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" />

To:

<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh={() => refresh()} />

This way, even if refresh() references a method defined elsewhere with stricter scope rules, it will still work correctly within the context of its owner element (GenerateRelatedDialog).

Expand Down