@briebug/ngrx-auto-entity
Advanced tools
Changelog
0.8.1 Beta (2022-05-05)
Added two new loading related selectors: hasBeenLoaded and loadWasAttempted. These selectors allow end developers to determine if a load has ever been attempted before, which is sometimes necessary to display the correct information in a UI component. Until a load has at least been attempted, it would generally be inappropriate to display to the user that there are no Entities X, however as the current state of each entity currently stands, there is no way to determine that particular state of an entity. You can determine if an entity is loading or not, which is useful for displaying a spinner, but other messaging requires more information.
<a name="0.8.0-beta.1"></a>
Changelog
0.8.0-beta.1 Beta (2022-04-05)
Updated state builders to build all state functionality "on-demand" to limit memory footprint when
lots of entities are used. This aligns selectors, facades, etc. with the way actions were implemented
when they were introduced to the state builder. Selectors for any given entity are only created
if they are accessed (i.e. destructured from the object returned by buildState
), and the same goes
for facades.
Performed a major internal refactor of the auto-entity reducer in order to break down the single monolithic reducer into a more modular design. Each set of related actions, such as loadAll, create, editing, selections, etc. have their own corresponding reducer. Actions are now mapped to the appropriate reducer through a centralized mapping for action-to-reducer routing.
These changes are internal, and should not present any breaking changes to the public API. That said, the changes are fairly extensive, and care should be used until 0.8 is officially released.
pipe
function to compose
<a name="0.7.2"></a>
Changelog
0.7.2 Beta (2022-01-24)
Resolved a discrepancy in optional loading, where if the entity were a part of feature state, and its state properties were nested underneath a feature state property on root state, the correct entity state property could not be found.
<a name="0.7.1"></a>
Changelog
0.7.0 Beta (2021-08-02)
This release officially adds support for Angular 12 and NgRx 12! With the advent of Ivy, and its
continued progress towards replacing View Engine, supporting Angular 12 required a bit more active
work to support. Currently, the library is built with enableIvy
set to false, which allows the
library to be built with support for View Engine versions of Angular.
Research and planning has begun on supporting Angular 13, however this will be a more challenging task than supporting Angular 12 due to the fact that View Engine will be dropped entirely from Ng 13, which will affect our ability to build a library that supports older versions of Angular. We hope to have a plan in place for this scenario soon.
This release also updates some internal usage of NgRx to drop use of legacy or fully deprecated
features, such as the @Entity
decorator.
@Effect()
decorator, and are now using
the current and recommended createEffect()
function. This is to ensure support with NgRx 12+.<a name="0.6.1"></a>
Changelog
0.6.0 Beta (2021-04-02)
Auto-Entity version 0.6 introduces NgRx 8+ compatible action factory functions. Similar to the
kind of actions (technically factory functions that create actions!) you get when using the
createAction
factory function from NgRx itself. This change is NON-Breaking, as all legacy
actions remain in place and fully usable, allowing migration to the new actions to be done
progressively if necessary.
New actions may be destructured from the object returend by calling buildState
and buildFeatureState
,
as with all other auto-entity state functionality. Simply destructure the new actions
property:
export const {
actions: {
loadAll: loadAllCustomers,
create: createCustomer,
update: updateCustomer,
delete: deleteCustomer,
select: selectCustomer,
deselect: deselectCustomer,
// ... many more!
}
} = buildState(Customer);
Actions introduce a new mechanism for building auto-entity state. Only the actions that are actually used (i.e. destructured) are actually created for the specified entity. This should limit the amount of memory used for auto-entity related functionality. This mechanism will be expanded to the rest of the state related functionality that can be generated by the build state calls in the future.
The breaking changes this release should be minimally breaking, and mostly backwards compatible except in fringe cases covering more unusual use cases. Conversion of selection properties from read only getters to simple fields should improve the unit testability of facades by allowing simpler mocks, stubs, and fakes, easier spying, etc. This may also improve support for more custom use cases and extensions in concrete facade classes.
EditNew
action (#161)editNew
activity method (#161)selectHasEntities
and selectHasNoEntities
selectors (#149)hasEntities$
and hasNoEntities$
selections to facades (#149)updatedAt
and replacedAt
timestamps in state for each entity<a name="0.5.0"></a>