Skip to content

fix: refresh post list after login #249

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
merged 1 commit into from
Nov 28, 2023
Merged
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
11 changes: 7 additions & 4 deletions src/auth/auth-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ import { LocalState } from '@/ctx/local-state'
import { ExtConst } from '@/ctx/ext-const'
import { UserService } from '@/service/user.service'
import { isAuthSessionExpired } from '@/auth/is-auth-session-expired'
import { PostListView } from '@/cmd/post-list/post-list-view'

authProvider.onDidChangeSessions(async () => {
authProvider.onDidChangeSessions(async e => {
await AuthManager.ensureSession({ createIfNone: false })
await AuthManager.updateAuthStatus()

accountViewDataProvider.fireTreeDataChangedEvent()
postDataProvider.fireTreeDataChangedEvent()
postCategoryDataProvider.fireTreeDataChangedEvent()

postCategoryDataProvider.refresh()

if (e.removed != null) postDataProvider.refresh()
else await PostListView.refresh()

await BlogExportProvider.optionalInstance?.refreshRecords({ force: false, clearCache: true })
})
Expand Down
4 changes: 4 additions & 0 deletions src/tree-view/provider/post-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export class PostDataProvider implements TreeDataProvider<PostListTreeItem> {
return this._onDidChangeTreeData.event
}

refresh(): void {
this._onDidChangeTreeData.fire(undefined)
}

getPage() {
return this.page
}
Expand Down