当前位置:网站首页>Design details related to sap e-commerce cloud Spartacus UI store
Design details related to sap e-commerce cloud Spartacus UI store
2022-07-24 00:44:00 【51CTO】
Store
state.ts
Defines and Site Context Business related State Data model .
The routine of defining data model is :
This is the top floor State Model .
SiteContextState It contains three sub State:
With CurrenciesState For example , It's not just about Entities list , It also includes the current Active State of Currency:
Redefine Entities list :
That's all Site Context Required by the field State data structure .
Be careful SITE_CONTEXT_FEATURE Where to use , In addition to the definitions in this document feature state outside , It is also used in the following two files :

scene 1: Used to create feature selector:

scene 2: Use StoreModule.forFeature register store:

When using createSelector and createFeatureSelector Function time ,@ngrx/store It keeps track of the latest parameters that call the selector function . Because selectors are pure functions , So when the parameters match, the last result can be returned , Without having to call the selector function again . This provides a performance advantage , Especially for selectors that perform expensive calculations . This practice is called memoization.
createFeatureSelector Is to return to the top (Top Level) Of Feature State A convenient way . It is the characteristic slice of the state (Feature Slice) Returns a typed (typed) Selector function of .
Be careful createFeatureSelector There are two ways to write the call of .
How to write it 1
The figure below 2 Must be 1 A slice of , also 3 The type of must be the same as 2 The same type of :

2 The location of is actually result The location of :

How to write it 2

I did a test , stay SAP E-commerce cloud Spartacus UI In the project , The two expressions are completely equivalent :

Can be successfully compiled :

边栏推荐
- Bean Validation使用篇----05
- Blockbuster | certik: Web3.0 industry safety report release in the second quarter of 2022 (PDF download link attached)
- Intelligent OCR identification of express documents helps the logistics industry to upgrade Digitalization
- Summary of polynomial commitment schemes
- Comparison of image preprocessing between pytorch opencv pil
- Gbase 8C mode visibility query function (2)
- NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library ‘*****‘
- Codeforces Round #807 (Div. 2)(A-D)
- 测试小码农也有大目标,最新BAT大厂面试题大总结(持续更新中...)
- [low code] limitations of low code development
猜你喜欢

How to speed up matrix multiplication -- optimizing GEMM (CPU single thread)

High number_ Chapter 1 space analytic geometry and vector algebra__ Two point distance

English grammar_ Demonstrative pronoun -such / the same

SAP 实施项目中涉及到编程方式操作 Excel 的几种场景介绍

Overview of data model design method

网络系统实验:ping不通的问题解决

Classic examples of C language - use 4 × The matrix displays all integers from 1 to 16 and calculates the sum of each row, column, and diagonal

Summary of polynomial commitment schemes

Classic examples of C language switch case statement conversion date format

Classic example of C language - convert the input two digits into English
随机推荐
postman测试接口在URL配置正确的情况下出现404或者500错误
Summary of polynomial commitment schemes
AVX instruction set accelerated matrix multiplication
Gbase 8C access authority query function (V)
《天幕红尘》笔记与思考(五)强势文化与弱势文化
Printf function - conversion description
Gbase 8C mode visibility query function (I)
Overview of data model design method
mysql 分支语句case报错
Classic example of C language - print the input two digits in reverse order
Xilinx FPGA one way clock input two PLLs
Easy gene | target gene DNA methylation sequencing (target BS)
T-seda code
Comparison of the shortcomings of redis master-slave, sentinel and cluster architectures
MySQL table field quantity limit and row size limit
Gbase 8C string operator
数据模型设计方法概述
Gbase 8C session information function (III)
采坑websocket总结
Classic examples of C language - use 4 × The matrix displays all integers from 1 to 16 and calculates the sum of each row, column, and diagonal