Skip to content

refactor(runtime): components to script setup - #3038

Open
JammingBen wants to merge 1 commit into
mainfrom
refactor/runtime-components-to-script-setup
Open

refactor(runtime): components to script setup#3038
JammingBen wants to merge 1 commit into
mainfrom
refactor/runtime-components-to-script-setup

Conversation

@JammingBen

Copy link
Copy Markdown
Member

refs #1462

@JammingBen JammingBen self-assigned this Aug 5, 2026
@JammingBen JammingBen added the Type:Maintenance E.g. technical debt, packaging, etc. label Aug 5, 2026
@JammingBen
JammingBen requested a lite review from Copilot August 5, 2026 10:56

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

This PR advances the ongoing refactor tracked in #1462 by converting several frequently used web-runtime Vue components from Options API / setup()+return to <script setup>, and updates the affected unit tests to align with the new component instance shapes.

Changes:

  • Refactored multiple runtime UI components (Topbar, Account, Modals, Sidebar) to <script setup lang="ts"> with typed defineProps (and defineEmits where applicable).
  • Updated unit tests that previously relied on Options API instance access (e.g., task .last, methods) to use flushPromises() or adjusted instance access.
  • Minor cleanup/modernization of component internals (top-level bindings, computed/method conversions).

Reviewed changes

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

Show a summary per file
File Description
packages/web-runtime/tests/unit/components/Topbar/Notifications.spec.ts Switched async waiting strategy to flushPromises() to accommodate <script setup> refactor.
packages/web-runtime/tests/unit/components/SkipTo.spec.ts Updated test approach after SkipTo.vue moved to <script setup>.
packages/web-runtime/tests/unit/components/ModalWrapper.spec.ts Adjusted tests to access script-setup instance members (casts).
packages/web-runtime/tests/unit/components/EditPasswordModal.spec.ts Updated tests for script-setup refs/methods (but currently contains incorrect assertions).
packages/web-runtime/tests/unit/components/Account/GdprExport.spec.ts Replaced task .last awaits with flushPromises().
packages/web-runtime/src/components/Topbar/Notifications.vue Converted to <script setup>; preserved polling/SSE behavior and task logic.
packages/web-runtime/src/components/Topbar/NotificationBell.vue Converted to <script setup> with typed props and reactive UI state.
packages/web-runtime/src/components/Topbar/FeedbackLink.vue Converted to <script setup> with typed props and computed fallbacks.
packages/web-runtime/src/components/Topbar/ApplicationsMenu.vue Converted to <script setup> with typed props and computed sorting/bindings.
packages/web-runtime/src/components/SkipTo.vue Converted to <script setup> and added null-guard for target element.
packages/web-runtime/src/components/SidebarNav/SidebarNavItem.vue Converted to <script setup> with typed props and computed bindings.
packages/web-runtime/src/components/ModalWrapper.vue Converted to <script setup>; kept modal confirm/cancel/input flows intact.
packages/web-runtime/src/components/EditPasswordModal.vue Converted to <script setup>; added typed defineEmits + defineExpose({ onConfirm }).
packages/web-runtime/src/components/Account/ThemeSwitcher.vue Converted to <script setup>; kept theme selection logic intact.
packages/web-runtime/src/components/Account/QuotaInformation.vue Converted to <script setup> (currently retains a quota optionality edge case).
packages/web-runtime/src/components/Account/GdprExport.vue Converted to <script setup>; preserved polling + request/download behaviors.
packages/web-runtime/src/components/Account/ExtensionPreference.vue Converted to <script setup>; preserved selection models and filtering.
packages/web-runtime/src/components/Account/AccountTable.vue Converted to <script setup> with typed props.
Suppressed comments (1)

packages/web-runtime/tests/unit/components/EditPasswordModal.spec.ts:34

  • This test case says passwords are not identical, but it both (a) does not call validatePasswordConfirm() and (b) expects a truthy value. It should call the function and assert false.
    it('should be false if passwords are not identical', () => {
      const { wrapper } = getWrapper()
      ;(wrapper.vm as any).newPassword = 'newpassword'
      ;(wrapper.vm as any).newPasswordConfirm = 'anothernewpassword'
      expect((wrapper.vm as any).validatePasswordConfirm).toBeTruthy()
    })

馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/web-runtime/tests/unit/components/SkipTo.spec.ts
Comment thread packages/web-runtime/src/components/Account/QuotaInformation.vue
@JammingBen
JammingBen force-pushed the refactor/runtime-components-to-script-setup branch from 1077097 to 1ac7ff4 Compare August 5, 2026 11:10
@JammingBen
JammingBen requested a lite review from Copilot August 5, 2026 11:10

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

Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.

Suppressed comments (3)

packages/web-runtime/src/components/SkipTo.vue:15

  • This component renders a default slot (<slot />) but doesn鈥檛 declare slots via defineSlots, which is part of the linked refactor acceptance criteria. Add an explicit defineSlots declaration.
const { target } = defineProps<{
  target: string
}>()

packages/web-runtime/src/components/Account/AccountTable.vue:40

  • This component renders a default slot (<slot />) but doesn鈥檛 declare slots via defineSlots, which is part of the linked refactor acceptance criteria. Add an explicit defineSlots declaration.
const { fields, showHead = false } = defineProps<{
  fields: Array<string | AccountTableCell>
  showHead?: boolean
}>()

packages/web-runtime/src/components/Topbar/NotificationBell.vue:29

  • notificationCount lost its default value (previously default: 0) and is now effectively required. This changes the component鈥檚 prop contract and can lead to undefined being rendered/compared if the prop is omitted. Use destructuring defaults to preserve the original behavior.
const { notificationCount } = defineProps<{
  notificationCount: number
}>()

@JammingBen
JammingBen requested a review from AlexAndBear August 5, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Maintenance E.g. technical debt, packaging, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants