-
-
Notifications
You must be signed in to change notification settings - Fork 133
feat(web): add findStores functions 🍪 🎼
#15437
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
Conversation
This change adds a static `findStores` function to `VarStoreSerializer` and `VariableStoreCookieSerializer` as well as to the `VariableStoreSerializer` interface. Also add unit tests for `VariableStoreCookieSerializer`. Part-of: #13426 Test-bot: skip
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
findStores functionsfindStores functions 🎼
findStores functions 🎼findStores functions 🍪 🎼
| @@ -9,27 +9,51 @@ import { CookieSerializer } from "keyman/engine/dom-utils"; | |||
| // dynamic property names; they'd have to be known at compile time to facilitate | |||
| // strict type checking. | |||
| class VarStoreSerializer extends CookieSerializer<VariableStore> { | |||
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.
So ... we have VarStoreSerializer, VariableStoreSerializer, VariableStoreCookieSerializer, and CookieSerializer<VariableStore>. Yuck! Why do we need 4? Can't we do this all with just one? What benefit are we getting with this complexity and confusion?
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.
Follow-up in #15470. It reduces the number of types, although it's still more than one - see PR description.
| // dynamic property names; they'd have to be known at compile time to facilitate | ||
| // strict type checking. |
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.
This comment (lines 4-10) is an excuse for the implementation, but doesn't help describe the purpose of the class. It's missing background which doesn't help a reader understand (a) what is this 'transformation' for, etc.
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 left that comment for now.
This addresses code review comments in #15437 and removes some unnecessary definitions related to variable stores. It keeps the `VariableStoreSerializer` interface although currently `VariableStoreCookieSerializer` is the only implementation. Conceptually IMO it makes sense to use a more abstract interface so that in the future for example we could easily use a different store for a node implementation. Details of this change: - remove `VariableStoreDictionary` interface and replace with `VariableStore` type - remove `VarStoreSerializer` class and replace with ` CookieSerializer<VariableStore>` - also fix baseline tests to use dynamic time value and set cookies to expire in 60s instead of at some arbitrary time which might be in the past. Follow-up-of: #15437 Test-bot: skip
This addresses code review comments in #15437 and removes some unnecessary definitions related to variable stores. It keeps the `VariableStoreSerializer` interface although currently `VariableStoreCookieSerializer` is the only implementation. Conceptually IMO it makes sense to use a more abstract interface so that in the future for example we could easily use a different store for a node implementation. Details of this change: - remove `VariableStoreDictionary` interface and replace with `VariableStore` type - remove `VarStoreSerializer` class and replace with ` CookieSerializer<VariableStore>` Follow-up-of: #15437 Test-bot: skip
This change adds a static
findStoresfunction toVarStoreSerializerandVariableStoreCookieSerializeras well as to theVariableStoreSerializerinterface.Also add unit tests for
VariableStoreCookieSerializer.Part-of: #13426
Test-bot: skip