Repository navigation
Conversation
| async function validatePrTitle({delegateTarget: field}: DelegateEvent<Event, HTMLInputElement>): Promise<void> { | ||
| // Include the PR number in the title length calculation because it will be added to the commit title | ||
| field.classList.toggle('rgh-title-over-limit', formatPrCommitTitle(field.value).length > limit); | ||
| const prTitle = await formatPrOrCompareCommitTitle(field.value); |
There was a problem hiding this comment.
by the way API calls are automatically cached (in RAM), so this should be instant after the first input event
|
I'm having trouble understanding the output of the Vitest failures: |
|
I opened an issue for |
Not sure that's actually causing the Vitest failures, see this successful test run from 1 hour ago (logs below) where the |
|
What looks potentially more interesting are these error messages here from the failing workflow run: I could try to track down any |
|
@fregante So the confusing Vitest test failures start as soon as Minimal reproduction:
import {$, elementExists, expectElement} from 'select-dom';
import onetime from 'onetime';
import elementReady from 'element-ready';
import compareVersions from 'tiny-version-compare';
import {RequireAtLeastOne} from 'type-fest';
import * as pageDetect from 'github-url-detection';
import mem from 'memoize';
+import api from './api.js';
import {branchSelector} from './selectors.js';
+console.log(api);This causes test failures of unrelated features eg.
Maybe there is some dependency in |
|
@fregante a possible fix for the Vitest tests is to switch from static // ...
-import api from './api.js';
import {branchSelector} from './selectors.js';
// This never changes, so it can be cached here
export const getUsername = onetime(pageDetect.utils.getUsername);
export const {getRepositoryInfo: getRepo, getCleanPathname} = pageDetect.utils;
export function getConversationNumber(): number | undefined {
const [, _owner, _repo, type, prNumber] = location.pathname.split('/');
return (type === 'pull' || type === 'issues') && Number(prNumber) ? Number(prNumber) : undefined;
}
export async function getNextConversationNumber(): Promise<number> {
+ const api = (await import('./api.js')).default;
const issues = await api.v3('issues?per_page=1');
return issues[0].number;
}Implemented in da7b5b9...763ac0e |
|
So yes the issue is about circular references. The solution would be to move this helper out of index.ts and into its own file. |
|
Done in 324602c...89b0a6e |
suggest-commit-title-limit - Retrieve number for compare pagessuggest-commit-title-limit - Fix length estimate limit
|
Thanks for the guidance, review and merge! |
suggest-commit-title-limit - Fix length estimate limitsuggest-commit-title-limit - Fix length limit on new PRs
Fixes #7689 (comment)
Test URLs
https://github.com/refined-github/refined-github/compare/main...karlhorky:refined-github:test/bun?expand=true
Screenshot