-fix: autocomplete check

This commit is contained in:
Sebastian 2022-01-25 09:26:12 -03:00
parent a51abcffb0
commit a06f7f7cbb
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
2 changed files with 7 additions and 3 deletions

View File

@ -23,8 +23,12 @@ export const parameters = {
controls: { expanded: true },
options: {
storySort: (a, b) => {
return (a[1].args.order ?? 0) - (b[1].args.order ?? 0)
// return a[1].kind === b[1].kind ? 0 : a[1].id.localeCompare(b[1].id, undefined, { numeric: true })
if (!a || !a[1]) {
// https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#v7-style-story-sort
console.log(a, b)
return (a?.args.order ?? 0) - (b?.args.order ?? 0)
}
return (a?.[1]?.args?.order ?? 0) - (b?.[1]?.args?.order ?? 0)
}
},
}

View File

@ -40,7 +40,7 @@ export function AttributeEntryScreen(): VNode {
function addAutocomplete(newValue: string): string {
const ac = spec.autocomplete;
if (!ac || ac.length < newValue.length || ac[newValue.length] === "?")
if (!ac || ac.length <= newValue.length || ac[newValue.length] === "?")
return newValue;
if (!value || newValue.length < value.length) {