Skip to content

Add JSON support to localStorageSync component

What does this MR do?

It adds a new prop (- json) - to the localStorageSync component.

When it's set to true it will serialize and de-serialize the passed -in value, when storing or retrieving from local-storage respectively before committing it to local-storage, and de-serialize after retrieval.

This will allow to use v-model to be used with non-string values, aslike demonstrated in this example: !42940 (diffs)

This is a non-breaking change and should not affect the current behaviour of localStorageSync

Credit: The approach and bulk of the changes have been proposed by @markrian - see discussion: !37169 (comment 402391738)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to- [ ] Informed Infrastructure department of a default or new setting change, if applicable per definition of done

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #247850 (closed)

Edited by David Pisek

Merge request reports

Loading