Skip to content

Reload on token-expired app error - #3837

Open
Hyatzy wants to merge 1 commit into
nextcloud:masterfrom
Hyatzy:fix/token-expired-auto-reload
Open

Reload on token-expired app error#3837
Hyatzy wants to merge 1 commit into
nextcloud:masterfrom
Hyatzy:fix/token-expired-auto-reload

Conversation

@Hyatzy

@Hyatzy Hyatzy commented Jul 10, 2026

Copy link
Copy Markdown

This adds a small App.vue watcher that reloads the page when the news app reports the "Token expired or app not enabled! Reload the page!" error, plus a unit test.

Refs #638.

@Hyatzy Hyatzy mentioned this pull request Jul 10, 2026
1 task
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/App.vue 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds client-side handling in the News frontend to auto-reload when a specific “token expired” error is detected, addressing the long-running-tab scenario described in #638.

Changes:

  • Add an App.vue watcher on app.error that triggers a full page reload when the token-expired error message appears.
  • Add a unit test to assert the reload behavior is triggered for that error.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/App.vue Adds token-expired detection and a reloadPage() helper to reload the app automatically.
tests/javascript/unit/components/App.spec.ts Adds a unit test verifying the watcher triggers a reload on the token-expired error.

Comment thread src/App.vue
Comment on lines +94 to +96
reloadPage() {
window.location.reload()
},
Comment on lines +62 to +69
it('should reload when token error is shown', () => {
const reloadSpy = vi.spyOn(wrapper.vm, 'reloadPage').mockImplementation(() => {})
const error = new Error('Token expired or app not enabled! Reload the page!')

wrapper.vm.$options.watch['app.error'].handler.call(wrapper.vm, error)

expect(reloadSpy).toHaveBeenCalled()
})
@Grotax Grotax added enhancement frontend impact Javascript/Frontend code labels Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement frontend impact Javascript/Frontend code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants