0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

🐛 Fixed Admin freeze when filtering long tag lists

closes https://github.com/TryGhost/Ghost/issues/15391

- `vertical-collection` component was throwing errors during render when the tags list was filtered down causing slowdowns or full Admin crashes
- similar regression had popped up before and fixed in https://github.com/TryGhost/Ghost/pull/15207 but the dependency had been bumped again without realising it caused an error
- added a test that triggers the error-throwing behaviour in the tags input to help catch this in future dependency updates
This commit is contained in:
Kevin Ansfield 2022-09-12 15:49:07 +01:00
parent a5b2648c07
commit e230370b33
3 changed files with 25 additions and 7 deletions

View file

@ -38,7 +38,7 @@
"@ember/test-helpers": "2.8.1",
"@embroider/macros": "1.8.3",
"@glimmer/component": "1.1.2",
"@html-next/vertical-collection": "3.1.0",
"@html-next/vertical-collection": "3.0.0",
"@joeattardi/emoji-button": "4.6.4",
"@sentry/ember": "7.12.1",
"@tryghost/color-utils": "0.1.21",

View file

@ -4,7 +4,7 @@ import sinon from 'sinon';
import {Response} from 'miragejs';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {beforeEach, describe, it} from 'mocha';
import {blur, click, currentRouteName, currentURL, fillIn, find, findAll, triggerEvent} from '@ember/test-helpers';
import {blur, click, currentRouteName, currentURL, fillIn, find, findAll, triggerEvent, typeIn} from '@ember/test-helpers';
import {datepickerSelect} from 'ember-power-datepicker/test-support';
import {expect} from 'chai';
import {selectChoose} from 'ember-power-select/test-support';
@ -614,5 +614,23 @@ describe('Acceptance: Editor', function () {
let body = JSON.parse(lastRequest.requestBody);
expect(body.posts[0].title).to.equal('CMD-S Test');
});
// https://github.com/TryGhost/Ghost/issues/15391
it('can handle many tags in PSM tags input', async function () {
this.server.createList('tag', 1000);
let post = this.server.create('post', {authors: [author]});
await visit(`/editor/post/${post.id}`);
await click('[data-test-psm-trigger]');
await click('[data-test-token-input]');
// by filtering to `Tag 100` it means we start with a long list that is reduced
// which is what triggers the slowdown/error
await fillIn('[data-test-token-input] input', 'Tag 10');
await typeIn('[data-test-token-input] input', '0');
await blur('[data-test-token-input] input');
// no expects, will throw with an error and fail when it hits the bug
});
});
});

View file

@ -2520,10 +2520,10 @@
resolved "https://registry.yarnpkg.com/@handlebars/parser/-/parser-2.0.0.tgz#5e8b7298f31ff8f7b260e6b7363c7e9ceed7d9c5"
integrity sha512-EP9uEDZv/L5Qh9IWuMUGJRfwhXJ4h1dqKTT4/3+tY0eu7sPis7xh23j61SYUnNF4vqCQvvUXpDo9Bh/+q1zASA==
"@html-next/vertical-collection@3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@html-next/vertical-collection/-/vertical-collection-3.1.0.tgz#3e271fe36bbf381b5e6f7702fde72f8c6880ae0d"
integrity sha512-7mzdEhPA0SzIAqZA/HUwmAYVxzbsKp4l8vB7oBc6A71IGusrNZQUMLl09Vi9wgHahvhBV89LST474cu9k2Iw1Q==
"@html-next/vertical-collection@3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@html-next/vertical-collection/-/vertical-collection-3.0.0.tgz#ba16bd2df413e9c25d245ae37ddb1950a5ccdbca"
integrity sha512-kpLYZXr3tlYkrSiyhww+f1YkyLMEhCm9h55A+PWPzJXBTZkV12sC5mIbxVcWD7q5QNjy634m6MMvmxfFgDmGoQ==
dependencies:
babel6-plugin-strip-class-callcheck "^6.0.0"
broccoli-funnel "^2.0.2"