Skip to content

Commit

Permalink
refactor: address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt committed Nov 28, 2024
1 parent 60cc59e commit 25615db
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
14 changes: 13 additions & 1 deletion packages/store/experimental/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
export { withExperimentalNgxsPendingTasks } from './pending-tasks';
import { withNgxsPendingTasks } from '@ngxs/store';

/**
* Required for correct functioning of SSR apps.
*
* @deprecated
* This experimental export is deprecated in favour of the non-experimental export.
* This is no longer an experimental feature, but is now available as
* `withNgxsPendingTasks` in the main `@ngxs/store` package.
*/
export function withExperimentalNgxsPendingTasks() {
return withNgxsPendingTasks();
}
4 changes: 3 additions & 1 deletion packages/store/src/pending-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { Actions, ActionStatus } from './actions-stream';
import { withNgxsPreboot } from './standalone-features/preboot';

/**
* This feature that contributes to app stability, * which is required during
* This feature that contributes to app stability, which is required during
* server-side rendering. With asynchronous actions being dispatched and handled,
* Angular is unaware of them in zoneless mode and doesn't know whether the app is
* still unstable. This may prematurely serialize the final HTML that is sent to the client.
* Including `withNgxsPendingTasks` in your `provideStore` for your SSR
* app will resolve the above issue.
*/
export function withNgxsPendingTasks() {
return withNgxsPreboot(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {
StateToken,
dispatch,
provideStore,
select
select,
withNgxsPendingTasks
} from '@ngxs/store';
import { freshPlatform, skipConsoleLogging } from '@ngxs/store/internals/testing';
import { withExperimentalNgxsPendingTasks } from '@ngxs/store/experimental';

describe('preboot feature + stable', () => {
const COUNTRIES_STATE_TOKEN = new StateToken<string[]>('countries');
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('preboot feature + stable', () => {
providers: [
provideExperimentalZonelessChangeDetection(),

provideStore([CountriesState], withExperimentalNgxsPendingTasks())
provideStore([CountriesState], withNgxsPendingTasks())
]
}),
{
Expand Down

0 comments on commit 25615db

Please sign in to comment.