Skip to content

Composition api#1967

Open
frankrousseau wants to merge 92 commits intocgwire:mainfrom
frankrousseau:composition-api
Open

Composition api#1967
frankrousseau wants to merge 92 commits intocgwire:mainfrom
frankrousseau:composition-api

Conversation

@frankrousseau
Copy link
Contributor

@frankrousseau frankrousseau commented Mar 10, 2026

Problem

  • Kitsu needs to be migrated to the composition API
  • AI reviewing was required on libs.

Solution

  • First step of the migration: migrate widget components
  • Run the review and fixes

frankrousseau and others added 30 commits March 5, 2026 02:47
- errors.js: compare window.location.pathname instead of window.location object
- models.js: check findIndex result against -1 instead of null
- lang.js: fix zh_Hant_TW language code typo (zw -> zh)
- query.js: encode URI components to prevent broken query strings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- video.js: extract PRECISION_FACTOR constant and roundPrecision helper, replace deprecated substr with substring
- render.js: batch all mention/department/taskType replacements into a single regex pass instead of O(n²) replaceAll loops
- indexing.js: use substring prefix instead of character-by-character string concatenation
- sorting.js: cache getTaskTypePriorityOfProd results before sorting to avoid redundant calls per comparison

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- csv.js: merge getStatReportsEntries and getRetakeStatReportsEntries into one function with options parameter (excludeStatuses, sortEntries)
- time.js: extract shared adjustBusinessDays helper for addBusinessDays and removeBusinessDays
- sorting.js: consolidate 5 sort*Result functions into a single sortEntityResult helper with per-entity config
- indexing.js: extract createIndexPair factory to replace 8 duplicated Object.create(null) pairs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- query.js: rename 'couples' to 'pairs' for standard naming
- models.js: simplify populateTask with array-based name building
- stats.js: extract createStatusEntry factory for repeated init blocks
- colors.js: simplify fromString with single conditional ColorHash instance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- drafts.js: add try-catch for localStorage operations (quota/security)
- preferences.js: add radix parameter to parseInt
- videoCache.js: remove console.log left in production code
- colors.js: extract DARK_STATUS_NAMES constant for validationTextColor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- video.js: extract DEFAULT_FPS constant (25)
- stats.js: extract RETAKE_CHART_COLORS and DEFAULT_STATUS_COLOR constants
- time.js: extract SUNDAY/SATURDAY as module-level constants, use isoWeeksInYear() instead of hardcoded 52

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- func.js: use Date.now() instead of new Date().getTime()
- descriptors.js: add guard for missing descriptor.choices
- crisp.js: add onerror handler for script load failure, remove unnecessary IIFE

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 4 new test files (clipboard, drafts, productions, errors) and
expand 7 existing test files with additional edge case coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove unused variables and parameters, convert promise callbacks to
async/await, fix useless escapes, and add eslint-disable comments for
browser globals in test environment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
frankrousseau and others added 28 commits March 5, 2026 11:10
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract duplicated task status color logic from ComboboxStatus and
ValidationTag into a shared useTaskStatusStyle composable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract duplicated @-mention member list logic (reactive state,
filter function, team/taskTypes watchers) from AddComment and Comment
into a shared useAtMentionsMembers composable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract the common toggle/select/showList pattern from ComboboxStatus,
ComboboxStatusAutomation, ComboboxStudio, and ComboboxProduction into
a shared useCombobox composable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert all function declarations in widget components to arrow
functions for consistency with the composables and modern style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 128 tests covering Combobox family (Combobox, ComboboxSimple,
ComboboxStyled, ComboboxBoolean, ComboboxNumber, ComboboxStatus,
ComboboxTag), SearchField, Checklist, and AddComment widgets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@NicoPennec NicoPennec left a comment

Choose a reason for hiding this comment

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

LGTM, just 2 minor changes

getIntPreference(key, defaultValue = 0) {
const item = this.getPreference(key)
const value = parseInt(item)
const value = parseInt(item, 10)
Copy link
Member

Choose a reason for hiding this comment

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

Radix is useless in modern browsers

const LOCALE_MAP = {
zh_Hans_CN: { language: 'zh', localeCode: 'zh-cn' },
zh_Hant_TW: { language: 'zw', localeCode: 'zh-tw' }
zh_Hant_TW: { language: 'zh', localeCode: 'zh-tw' }
Copy link
Member

@NicoPennec NicoPennec Mar 11, 2026

Choose a reason for hiding this comment

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

It's not a typo, 'zw' is the right value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants