This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($cookies): remove the deprecated $cookieStore factory #16465
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gkalpak
suggested changes
Feb 21, 2018
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 would make the following changes to the commit message:
- fix($cookies) --> fix(ngCookies) (because you are not really changing
$cookies
) - $cookie --> $cookies (everywhere)
- It might be simpler to drop the differentiation between simple and object values and just recommend
$cookies.get/putObject()
(since this is what$cookieStore
was using under the hood.
At least, we should mention that$cookies.get()
will not correctly retrieve simple values stored with$cookieStore.put()
(since the stored values will be JSON-stringified and need to be JSON-parsed).
docs/content/api/index.ngdoc
Outdated
<li>The {@link ngCookies.$cookies $cookie} service is a convenient wrapper to store simple data within browser cookies.</li> | ||
<li>{@link ngCookies.$cookieStore $cookieStore} is used to store more complex data using serialization.</li> | ||
</ul> | ||
The {@link ngCookies.$cookies $cookie} service is a convenient wrapper to store simple data within browser cookies. |
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.
$cookie --> $cookies
BREAKING CHANGE: The $cookieStore has been removed. Migrate to the $cookies service. Note that for object values you need to use the `putObject` & `getObject` methods as `get`/`put` will not correctly save/retrieve them. Before: ```js $cookieStore.put('name', {key: 'value'}); $cookieStore.get('name'); // {key: 'value'} $cookieStore.remove('name'); ``` After: ```js $cookies.putObject('name', {key: 'value'}); $cookies.getObject('name'); // {key: 'value'} $cookies.remove('name'); ```
@gkalpak PR updated. |
gkalpak
approved these changes
Mar 12, 2018
jbedard
approved these changes
Mar 12, 2018
3 tasks
3 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix - a removal of a deprecated factory.
What is the current behavior? (You can also link to an open issue here)
The
$cookieStore
factory exists.What is the new behavior (if this is a feature change)?
It doesn't.
Does this PR introduce a breaking change?
Yes.
Please check if the PR fulfills these requirements
Other information:
BREAKING CHANGE:
The $cookieStore has been removed. Migrate to the $cookie service. For simple
values it's enough to rename $cookieStore to $cookie; for object values you need
to use the
putObject
&getObject
methods.Before:
After: