Replace STORE_NAME usage with named constants
See original GitHub issueFor historical purposes we mix use of STORE_NAME
and named constants for modules (like CORE_SITE
or MODULES_ANALYTICS
). But in files with multiple stores, the unnamed STORE_NAME
provides little context, and now that the named constants are also available, we should replace all instances of STORE_NAME
with the actual constant name (eg. CORE_SITE
, CORE_USER
, etc.)
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- All instances of
STORE_NAME
throughout the code should be replaced with the “named constant” they represent. - Any other instances of
STORE_NAME
(for instance, increate-settings-store.js
), should be renamed to something likesettingsStoreName
so they don’t invoke confusion for current developers because of the historical context ofSTORE_NAME
. Using the constant formatting in this file isn’t really appropriate anyway. 🙂
Implementation Brief
- Replace all instances of
STORE_NAME
throughout the code with the appropriate named constant for the module. - Remove the
STORE_NAME
variables declarations in module constants files like https://github.com/google/site-kit-wp/blob/b6dade1a841d681c1df1f3d6fc5b5378ad5a6652/assets/js/googlesitekit/datastore/location/constants.js#L19, changes it to beexport const CORE_LOCATION = 'core/location';
- In places like https://github.com/google/site-kit-wp/blob/b6dade1a841d681c1df1f3d6fc5b5378ad5a6652/assets/js/googlesitekit/data/create-existing-tag-store.test.js#L33 that use a “Test” store/store name, change the variable to
TEST_STORE
. - Replace https://github.com/google/site-kit-wp/blob/b6dade1a841d681c1df1f3d6fc5b5378ad5a6652/assets/js/googlesitekit/data/create-settings-store.js#L82 with a variable like
settingsStoreName
—do the same in other generated stores with an appropriate variable name.
Test Coverage
- N/A
Visual Regression Changes
- N/A
QA Brief
- All unit tests and linting should continue to pass.
- Verify no
STORE_NAME
constants are used/imported/exported fromconstants.js
files. - Note that in many
create-X-store.js
files and tests there will be properties/internal variables withSTORE_NAME
values—these are separate and since they’re part of the API not worth changing here. They’re also internal and don’t cause the confusion this issue intended to fix 🙂
Changelog entry
- N/A
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to Change Shopify Store Name: 2021 Guide - Cart2Cart
The post explains how to change Shopify store name in a few simple steps without breaking anything on your eCommerce platform.
Read more >Why does Kafka change store name - Stack Overflow
Use following: KTable<Long, byte[]> table = stream.groupByKey().aggregate(() -> null , (key, oldVal, newVal) -> { return newVal; } ...
Read more >How to Use GraphQL Operation Names and Variables - Shopify
In this tutorial, we explore GraphQL operation names and variables for Shopify app development.
Read more >Configuration files for distributed stores
storeName -spring.xml. * storeName-spring.properties. A distributed store is configured using a bean element in the Spring XML configuration file.
Read more >Example C Program: Setting and Getting Certificate Store ...
In this article. The following example sets and gets a certificate store property, the localized store name. This property is not persisted ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I feel this is a
QA:Eng
ticket but if I am incorrect then please feel free to let me know!STORE_NAME
throughout the codebase and noSTORE_NAME
constants are used/imported/exported fromconstants.js
files. ☑️STORE_NAME
is only present increate-X-store.js
files. ☑️QA: ✅