-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(store): handle empty array dispatch edge case #1521
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that providing a warning is the right approach here.
I think that we should ensure that the next
callback is hit even if the observable returned within the action is completed as empty.
Also if you call dispatch with an empty array it should call next
and complete
immediately.
Maybe pipe with |
@markwhitfeld @arturovt please review again |
Also, could you move |
I like this idea! Or even |
@markwhitfeld @arturovt please review again |
@arturovt sorry, |
Blocked: #1526 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Nice job.
* Update authentication.md (ngxs#1408) Fix 66 line * test(store): add test for propGetter (ngxs#1460) * test(store): add test for propGetter * small fix * small fix * chore: update CHANGELOG.md * chore(deps): update all dependencies * docs: add attach-action as labs project (ngxs#1470) * feat: drop support for Angular 5 (ngxs#1464) * build: skip support Angular 5 * build: skip support Angular 5 * small fix * use angular.json instead .angular-cli.json * update CHANGELOG.md * update CHANGELOG.md * revert * chore: update CHANGELOG.md * fix: use generic `ModuleWithProviders` type for Ivy compatiblility (ngxs#1469) * fix(logger-plugin): overload `ModuleWithProviders` type to make it Ivy compatible * feat: overload `ModuleWithProviders` everywhere * feat: overload `ModuleWithProviders` everywhere * chore: made a small change to force rebuild * revert: undo random change * fix typo * chore: update CHANGELOG.md [skip ci] * docs: add Ivy migration guide (ngxs#1468) * chore: update CHANGELOG.md * feat(store): warn about undecorated state class if Ivy and JIT are both enabled (ngxs#1472) * feat(store): warn about undecorated state class if Ivy and JIT are both enabled * fix: condition * fix: * fix: move function to another file * fix: make bundlesize happy * chore: update CHANGELOG.md [skip ci] * refactor(store): remove unneeded mergeObject function (ngxs#1463) * fix(store): reduce bundle size * breaking: remove ObjectUtils * small fix * small fix * chore: add new funding npm package property * build(router-plugin): provide UMD name of the external module (ngxs#1475) * ci: workaround build failed for Travis CI (ngxs#1481) * ci: disable cache for Travis CI (ngxs#1484) * use cache yarn * small fix * small fix * feat(store): warn about undecorated state class if Ivy is enabled in dev (both JIT/AOT) (ngxs#1474) * feat(store): warn about undecorated state class if Ivy is enabled in dev (both JIT/AOT) * fix: rename * fix: dont invoke in tests * refactor(store): remove unneeded mergeObject function (ngxs#1463) * fix(store): reduce bundle size * breaking: remove ObjectUtils * small fix * small fix * chore: add new funding npm package property * fix: make bundlesize happy * fix: remove async behavior * test: add Ivy test * fix: linter * fix: move cpx to root * fix: move cpx to root * fix: resolve invalid path for NGCC compiled package * fix: restore `yarn.lock` removed by mistake * chore: update CHANGELOG.md [skip ci] * refactor: correct usage host tokens (ngxs#1489) * chore: updatec CHANGELOG.md [skip ci] * chore: update CHANGELOG.md * chore: update CHANGELOG.md [skip ci] * fix(devtools-plugin): remove `NgxsModule` from imports to ensure Ivy compatibility (ngxs#1491) * chore: update CHANGELOG.md * build: add E2E tests for the Ivy integration (ngxs#1492) * chore: update CHANGELOG.md * docs(projects): adding a new project (ngxs#1493) * chore: prepare 3.6 release article (ngxs#1488) * chore: prepare 3.6 release article * chore: preparing release article * chore: a few more tweaks to the release article * chore: unicorn for Ivy it is * chore: small tweaks * chore: more work on the release article * chore: more improvements to the announcement post * chore: added intro * chore: last few tweaks * chore: update CHANGELOG.md in preparation for release * chore: release v3.6.0 * build: upgrade to Angular 9.rc-6 (ngxs#1496) * build: run sync ngcc (ngxs#1497) * docs: update token.md - fix example (ngxs#1498) @selector() expects an array. Current preview does not work. Type error. * chore: update CHANGELOG.md * chore: update intro.md * chore: update intro.md * docs: sync with master (ngxs#1505) * docs: update token.md - fix example (ngxs#1498) @selector() expects an array. Current preview does not work. Type error. * chore: update intro.md Co-authored-by: PVermeer <[email protected]> * build: add router-plugin back to ivy integration test (ngxs#1506) * chore: update CHANGELOG.md [skip ci] * chore: clean up articles after release * chore: add vNext article template * fix: selectors should be deterministic based on store being used (ngxs#1508) * test: add failing test proving lack of isolation * test: improve store isolation tests * docs: fix spelling mistake * refactor: remove unnecessary code * fix: make selectors more deterministic based on calling store * chore: add note about v4 changes to exposed metadata api * refactor: rename depth to path to avoid confusion around the concept * test: add additional tests for @selector determinism * chore: increase bundle size accordingly * fix: handle lazy loaded scenario * test: improve ssr cypress tests * chore: update CHANGELOG.md [skip ci] * chore: increase bundle size accordingly * chore: update CHANGELOG.md * build: add funding metadata to packages * fix: add support for using state tokens in sub states (ngxs#1509) * fix: add support for using state tokens in sub states * chore: update CHANGELOG.md * chore(deps): update all dependencies * fix(store): optimize selector runtime binding (ngxs#1510) * fix: optimize selector runtime binding * fix: remove unused selectFromAppState function * refactor: hide new metadata methods from the exposed API * refactor: remove unused type * test: fix typings in tests * chore: update bundlesize * chore: use existing type alias * chore: update CHANGELOG.md * chore: CHANGELOG.md * fix: selectors should not be declaration order sensitive (ngxs#1514) * fix: selectors should not be declaration order sensitive * docs: remove the info related to the selector ordering issue * chore: update CHANGELOG.md * chore: update bundle sizes * chore: bundlesize config tweak * chore: update CHANGELOG.md in preparation for release * chore: release v3.6.1 * chore: upgrade to rc.11 (ngxs#1518) * fix(store): fix regression after upgrade to angular.rc-11 (ngxs#1526) * fix(store): fix regression after upgrade to angular.rc-11 * fixup * chore: update CHANGELOG.md [skip ci] * chore(deps): update all dependencies * chore: prettier format (ngxs#1527) * fix(store): handle empty array dispatch edge case (ngxs#1521) * chore: update CHANGELOG.md * chore: update Ivy integration project to Angular v9.0.0 * Revert "chore: prettier format (ngxs#1527)" This reverts commit e0480a1. * chore: update CHANGELOG.md in preparation for release * chore: release v3.6.2 * docs: fix links (ngxs#1530) * docs: update example to provide service in the root injector (ngxs#1538) * docs: add noticable links to ivy migration guide (ngxs#1542) * feat(storage-plugin): add before and after serialize hooks (ngxs#1513) * chore(deps): update all dependencies * feat(storage-plugin): reset * Revert "chore(deps): update all dependencies" This reverts commit 3d96df0. * Update bundlesize.config.json Co-authored-by: Renovate Bot <[email protected]> * chore: update CHANGELOG.md * perf(logger): lazy inject the store once only (ngxs#1550) * perf(logger): improve speed by using lazy injection once only * refactor: name private variables correctly * chore: update CHANGELOG.md * chore: update bundlesize * @Injectable() added to top of the Class for IVY Support (ngxs#1553) * Angular9 @Injectable updates (ngxs#1552) * Angular9 @Injectable updates * Update authentication.md * @Injectable() added to top of the Class for IVY Support (ngxs#1554) * @Injectable() added to top of the Class for IVY Support * update @Injectable() * @Injectable() added to top of the Class for IVY Support (ngxs#1555) * @Injectable() added to top of the Class for IVY Support * update @Injectable() * @Injectable() added to top of the Class for IVY Support (ngxs#1553) (ngxs#1556) * @Injectable() added to top of the Class for IVY Support (ngxs#1553) * Angular9 @Injectable updates (ngxs#1552) * Angular9 @Injectable updates * Update authentication.md * @Injectable() added to top of the Class for IVY Support (ngxs#1554) * @Injectable() added to top of the Class for IVY Support * update @Injectable() * @Injectable() added to top of the Class for IVY Support (ngxs#1555) * @Injectable() added to top of the Class for IVY Support * update @Injectable() Co-authored-by: Alp <[email protected]> * docs: added simple exmple on how to unsubscribe from action handlers (ngxs#1557) * added simple exmple on how to unsubscribe from action handlers * docs(website): improved docs on action handlers * improved sentence * docs: add @Injectable above every state class declaration (ngxs#1560) * docs: fix typo (ngxs#1562) * docs: fix typo (ngxs#1562) (cherry picked from commit 7bcba2b) * docs: improve intro root module sample (ngxs#1563) * docs: fix inherited selector example fixes ngxs#1564 * docs(ngxs-labs): include firestore plugin (ngxs#1566) * docs: remove deprecated testbed.get (ngxs#1569) * docs: remove deprecated testbed.get (ngxs#1569) (ngxs#1570) Co-authored-by: Dimitri Bret <[email protected]> * feat(logger-plugin): action filter in Logger Plugin (ngxs#1571) * feat(logger-plugin): add filter to NgxsLoggerPluginOptions * feat(logger-plugin): add filter to loggerOptionsFactory * feat(logger-plugin): handle filter predicate * feat(logger-plugin): add state as predicate parameter * feat(logger-plugin): pass state snapshot to filter predicate * docs(logger-plugin): add description for filter option * docs: add logger plugin filter to announcement article * ci(logger-plugin): update bundle sizes * ci(logger-plugin): increase fesm5 bundle size to 12.614KB * ci(logger-plugin): increase fesm5 bundle size to 12.619KB * chore: update CHANGELOG.md (skip ci) * chore: update CHANGELOG.md (skip ci) * chore: update packages (ngxs#1576) * build: add the missing decorator before upgrading to Angular 9 (ngxs#1577) * build: upgrade dtslint (ngxs#1580) * Update form.md (ngxs#1581) Update form.md to contain a FormFuilder example. * Update form.md (ngxs#1581) (ngxs#1582) Update form.md to contain a FormFuilder example. Co-authored-by: Jose E <[email protected]> * docs(form-plugin): updated form.md (ngxs#1583) * docs(form-plugin): updated form.md Added an ngOnInit as well as the imports in order to help people who might not be as familiar. * docs(form-plugin): update form.md Moved the FormBuilder into the constructor * chore: update CHANGELOG.md * docs(storage-plugin): update changelog related to serialization interceptors (ngxs#1587) * Update article.md * Update storage.md * build: add build integration test with Angular 8 (ngxs#1591) * build: add build integration test with Angular 8 * !fixup * feat: upgrade to support Angular 9 (ngxs#1596) #1 Error applying workspace layer for job: Concurrent upstream jobs persisted the same file(s) Update config.yml ngxs#2 Error applying workspace layer for job: Concurrent upstream jobs persisted the same file(s) ngxs#3 Error applying workspace layer for job: Concurrent upstream jobs persisted the same file(s) ngxs#4 Error applying workspace layer for job: Concurrent upstream jobs persisted the same file(s) ngxs#5 Error applying workspace layer for job: Concurrent upstream jobs persisted the same file(s) ngxs#6 Error applying workspace layer for job: Concurrent upstream jobs persisted the same file(s) ngxs#6 Error applying workspace layer for job: Concurrent upstream jobs persisted the same file(s) chore: remove redundant revert ng test ngxs#2 revert ng test ngxs#3 revert ng test * chore: update CHANGELOG.md * chore: fix typo * chore(deps): update all dependencies * Update hmr.md (ngxs#1608) Update hmr.md so that <project-name> can be seen in the docs * fix(router-plugin): update state after route successfully activates (ngxs#1606) Co-authored-by: Troy <[email protected]> * chore: update CHANGELOG.md * docs(projects): add a new community project (ngxs#1611) * fix(hmr-plugin): show error when use Angular Ivy with JIT mode (ngxs#1607) * fix(hmr-plugin): show error when use Angular Ivy with JIT mode * fix(hmr-plugin): local handling ivy mode + detect jit * fix: bundlesize.config.json * revert * fix: use __annotation__ for detect JIT, remove Ivy() fn * fix typo * fix: correct detect ivy mode * revert bundlesize.config.json * Update CHANGELOG.md * doc: better documentation for the reset function (ngxs#1614) * doc: better documentation for the reset function - the reset function needs as key value the state name which needs to be reseted * docs(unit-testing): extend documentation with snapshot - add snapshot to have a merged state after reset * docs(testing): better hint of store.reset usage - Add better note and understanding that reset will restore the whole stage we the new given * fix: do not cancel actions if action handler completes without emitting (ngxs#1615) * fix: do not cancel actions if action handler completes without emitting * chore: update CHANGELOG.md * fix: ofAction* methods should prevent passing anything except of `ActionType` (ngxs#1616) * fix: ofAction* methods should prevent passing anything except of `ActionType` * chore: update CHANGELOG.md * fix(logger-plugin): filter out only `undefined` payloads (ngxs#1617) * fix(logger-plugin): filter out only `undefined` payloads * chore: update CHANGELOG.md * test: change setup to setupWithLogger * docs: create optimizing-selectors page (ngxs#1622) * docs(optimizing-selectors): create doc docs(optimizing-selectors): fix typo * docs(optimizing-selectors): add more information * docs(optimizing-selectors): fix white space Co-authored-by: Artur Androsovych <[email protected]> * docs(optimizing-selectors): fix white space Co-authored-by: Artur Androsovych <[email protected]> * docs(optimizing-selectors): fix meta-selector * docs(optimizing-selectors): update selector options text * docs(optimizing-selectors): update selector class name Co-authored-by: Mark Whitfeld <[email protected]> Co-authored-by: Troy <[email protected]> Co-authored-by: Artur Androsovych <[email protected]> Co-authored-by: Mark Whitfeld <[email protected]> * perf: do not create `new Observable()` every time when subscribing to `ivyEnabledInDevMode$` (ngxs#1624) * feat(form-plugin): add reset form action (ngxs#1604) * feat(form-plugin): add reset form action * docs(form-plugin): add reset form action information * refactor(form-plugin): reset action logic changed Some test cases added: - reset form state without bounding ngxsForm - reset form with bounding with ngxsForm with 500 ms debounce time * refactor(form-plugin): update bundlesize.config.json * refactor(form-plugin): remove propertyPath on reset action * docs(form-plugin): brief overview added * docs(form-plugin): small language changes Co-authored-by: Mehmet Ozan Turhan <[email protected]> * chore: update CHANGELOG.md * build: upgrade TS to 3.9 to ensure that no breaking changes get added (ngxs#1626) * fix(devtools-plugin): actions with "action" property end up logged with <UNDEFINED> (ngxs#1628) * fix: actions with "action" property end up logged with <UNDEFINED> make action:null before sending to devtools * test(devtools-plugin): test make action=null * chore: update CHANGELOG.md * feat: throw an error when actions do not have a static type property (ngxs#1625) * feat: throw an error when actions do not have a static type property * feat: throw an error when actions do not have a static type property * chore: update CHANGELOG.md * test: ensure that plain objects w/o type also are not allowed * feat: replace throw with `throwError` * test: update spec names * chore: revert type def according PR review * chore: remove some whitespace Co-authored-by: Mark Whitfeld <[email protected]> * fix(store): remove the recent `@Select` type safety check due to issues with private/protected properties (ngxs#1623) * test: expect errors when using private/protected with select decorator * chore: rename state * !fixup * fix(store): remove implement SelectType<T> due to cannot assign @select to private/protected property * chore: modifications method name * chore: update CHANGELOG.md * chore: update CHANGELOG.md * chore: tweak CHANGELOG.md wording * chore: tweak test name Co-authored-by: Mark Whitfeld <[email protected]> * docs: add a side note about strict mode (ngxs#1635) * docs: add a side note about strict mode * chore: added extra note Co-authored-by: Mark Whitfeld <[email protected]> * ci: set default reviewers (ngxs#1639) * chore(deps): update dependency typescript to ^3.9.6 * chore(deps): update dependency typescript to ^3.9.7 * chore: bump angular version in peerDependencies (ngxs#1645) * test(integrations): add ng 10 ivy (ngxs#1641) * chore(ng-10-ivy): ng new * chore: fix script integration:ng10ivy * chore: install scripts * chore: yarn.lock * chore: make sure ivy is enabled * chore: ng-10-ivy app * test: include e2e test * docs: update doc * test: migrate to jest * chore(deps): ng-10-ivy integration * test: delete * chore: deleted per artur * chore: ignore yarn-error.log * ci: run ng10 integration test * test: add test * ci: run tests on ci * test: remove jest-preset-angular * test: set config emitDecoratorMetadata=true * test(integrations): add ng 10 ivy off (ngxs#1647) * test(integrations): add ng 10 ivy off * ci: fix step command Co-authored-by: Mark Whitfeld <[email protected]> * chore: update CHANGELOG.md [skip ci] * chore: rename integration step (ngxs#1652) * docs(hmr): deprecation note (ngxs#1654) * docs(hmr): include workaround using storage-plugin (ngxs#1656) * docs(hmr): deprecation note * docs(hmr): include workaround using storage-plugin * chore: update bundlesize after hmr update * Feature/ng9 ivy integration tests (ngxs#1649) * chore: rename integrations/ivy to integrations/hello-world-ng9-ivy * test: create ng9 no ivy integration tests * test: add new integration tests to ci and onfigure ng9 without ivy * test: remove ngcc in non ivy test and negate ivy tests in ivyoff * ci: add ng9 checks to travisci * ci: try running no ivy before with ivy * ci: fix format * test: ng9 e2e deps * chore: update CHANGELOG.md [skip ci] * fix(docs): add new slack invite link * test: integrations ng9 ivy (ngxs#1664) pin jest and jest-preset-angular versions * test(integration): create ng7 integration tests (ngxs#1659) * test: create ng7 integration tests * chore: add e2e for ng7 * test: remove unit test run from integration * test: remove test because jest builder conflicts with angular 7 * test(integration): readd tests to ng7 integration project (ngxs#1665) * feature(form-plugin): ngxsFormClearOnDestroy should allow the attribute with no value (ngxs#1662) * Update actions.md * putting full stop * adding constructor to add class * spacing between the class and upper case * add more explanation to group action * fix(form-plugin): adding coerceBoolean method * style(form-plugin): removing the console.log * removing console.log * fix(form-plugin): adding unit test for ngxsFormClearOnDestroy * fix(form-plugin): inline the function * fix(form-plugin): strict type check for null * fix(form-plugin): change !== to != Co-authored-by: Mark Whitfeld <[email protected]> * test(form-plugin): clean up ngxsFormClearOnDestroy tests (ngxs#1666) * chore: update CHANGELOG.md * chore: update CHANGELOG.md in preparation for release * chore: release v3.7.0 * chore: prepare publication folder for next release notes * docs(plugins): add link in readme for ngxs-loading-plugin (ngxs#1671) * docs: fix wording in unit-testing.md (ngxs#1667) Fix incorrect wording * fix: release NGXS resources when the root module gets destroyed (ngxs#1669) * fix: release NGXS resources when the root module gets destroyed * fix: update bundlesize * fix: lint * chore: update CHANGELOG.md * fix: update bundlesize * fix(storage-plugin): resolve state name correctly if the state class has been provided (ngxs#1670) * fix(storage-plugin): resolve state name correctly if the state class has been provided * chore: update CHANGELOG.md Co-authored-by: Mark Whitfeld <[email protected]> Co-authored-by: Daniil Gorodilov <[email protected]> Co-authored-by: Max Ivanov <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: David Leitner <[email protected]> Co-authored-by: Artur Androsovych <[email protected]> Co-authored-by: Mark Whitfeld <[email protected]> Co-authored-by: Mustapha Aouas <[email protected]> Co-authored-by: PVermeer <[email protected]> Co-authored-by: Levent Arman Özak <[email protected]> Co-authored-by: David Morissette <[email protected]> Co-authored-by: Alp <[email protected]> Co-authored-by: Florin Cosmin <[email protected]> Co-authored-by: Ilia Ametov <[email protected]> Co-authored-by: Joaquin Cid <[email protected]> Co-authored-by: Dimitri Bret <[email protected]> Co-authored-by: Jose E <[email protected]> Co-authored-by: Scott Reed <[email protected]> Co-authored-by: Troy Dietz <[email protected]> Co-authored-by: Troy <[email protected]> Co-authored-by: sandb0x4477 <[email protected]> Co-authored-by: Mitko Tschimev <[email protected]> Co-authored-by: Mehmet Ozan Turhan <[email protected]> Co-authored-by: Mehmet Ozan Turhan <[email protected]> Co-authored-by: Agustin Polo <[email protected]> Co-authored-by: Mark Whitfeld <[email protected]> Co-authored-by: Agustin Polo <[email protected]> Co-authored-by: shahid ahmad <[email protected]> Co-authored-by: Lucas Frecia <[email protected]>
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #759
What is the new behavior?
Warning output
Does this PR introduce a breaking change?