Allow updating project annotations before selection

This commit is contained in:
Tom Coleman 2022-09-08 17:08:17 +10:00
parent 08abb0274d
commit c6d0b40f1e
2 changed files with 13 additions and 1 deletions

View File

@ -3144,6 +3144,16 @@ describe('PreviewWeb', () => {
});
});
describe('with no selection', () => {
// eslint-disable-next-line jest/expect-expect
it('does not error', async () => {
const preview = await createAndRenderPreview();
await preview.onGetProjectAnnotationsChanged({
getProjectAnnotations: newGetProjectAnnotations,
});
});
});
it('shows an error the new value throws', async () => {
document.location.search = '?id=component-one--a';
const preview = await createAndRenderPreview();

View File

@ -181,7 +181,9 @@ export class PreviewWeb<TFramework extends AnyFramework> extends Preview<TFramew
}) {
await super.onGetProjectAnnotationsChanged({ getProjectAnnotations });
this.renderSelection();
if (this.urlStore.selection) {
this.renderSelection();
}
}
// This happens when a glob gets HMR-ed