Skip to content

Commit 38de79c

Browse files
committed
preload enums on first edit
1 parent 500ff6b commit 38de79c

2 files changed

Lines changed: 29 additions & 11 deletions

File tree

editor/src/app/components/library-page/library-page.component.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,6 @@ export class LibraryPageComponent implements OnInit, OnDestroy, AfterViewInit {
135135
this.detectScreenSize();
136136
this._ui.toggleCommandListElements(true);
137137

138-
this.canEdit$.pipe(take(1), filter(Boolean)).subscribe(() => {
139-
// we need to preload extensions for cross-edits to work
140-
Object.values(Game).forEach((game) => {
141-
this._extensions.loadExtensions(game);
142-
});
143-
144-
// Object.values(Game).forEach((game) => {
145-
// this._enums.loadEnums(game);
146-
// });
147-
});
148-
149138
getBaseGames().forEach((game) => {
150139
this._snippets.loadSnippets(game);
151140
});

editor/src/app/state/ui/effects.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,35 @@ export class UiEffects {
273273
{ dispatch: false }
274274
);
275275

276+
preloadEnums$ = createEffect(
277+
() =>
278+
this._actions$.pipe(
279+
ofType(displayOrEditEnum),
280+
first(({ viewMode }) => viewMode === ViewMode.EditEnum),
281+
tap(() => {
282+
Object.values(Game).forEach((game) => {
283+
this._enums.loadEnums(game);
284+
});
285+
})
286+
),
287+
{ dispatch: false }
288+
);
289+
290+
// we need to preload extensions and enums for cross-edits to work
291+
preloadExtensions$ = createEffect(
292+
() =>
293+
this._actions$.pipe(
294+
ofType(displayOrEditCommandInfo),
295+
first(({ viewMode }) => viewMode === ViewMode.EditCommand),
296+
tap(() => {
297+
Object.values(Game).forEach((game) => {
298+
this._extensions.loadExtensions(game);
299+
});
300+
})
301+
),
302+
{ dispatch: false }
303+
);
304+
276305
resetPagination$ = createEffect(() =>
277306
merge(
278307
this._actions$.pipe(

0 commit comments

Comments
 (0)