Skip to content
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

feat(workspace): Created reusable ScopedStorage #13920

Merged
merged 11 commits into from
Oct 25, 2024

Conversation

framitdavid
Copy link
Collaborator

@framitdavid framitdavid commented Oct 25, 2024

Description

This pull request introduces ScopedStorageImpl, a class designed to manage storage records under a specific key. While it provides scoped access similar to browser storage, it is not restricted to browser environments. Instead, this implementation leverages dependency inversion by taking a ScopedStorage interface as a dependency, allowing the flexibility to replace the storage mechanism as needed. This approach enables the use of alternative storage backends, such as remote storage solutions, without requiring significant codebase refactoring.

Through dependency inversion, ScopedStorageImpl becomes adaptable and scalable, facilitating future storage migrations by simply switching the underlying ScopedStorage dependency. The primary methods, setItem, getItem, and removeItem, support JSON-encoded data management, while parseStorageData ensures type safety and includes error handling for invalid JSON inputs, using console.error. This design promotes cleaner code organization and enhances scalability by keeping storage dependencies flexible and maintainable.

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

@github-actions github-actions bot added solution/studio/designer Issues related to the Altinn Studio Designer solution. frontend labels Oct 25, 2024
@framitdavid framitdavid changed the title feat(pure-functions): Created a class to handle feat(pure-functions): Created reusable ScopedStorage Oct 25, 2024
@framitdavid framitdavid changed the title feat(pure-functions): Created reusable ScopedStorage feat(workspace): Created reusable ScopedStorage Oct 25, 2024
@framitdavid framitdavid added team/studio-core skip-releasenotes Issues that do not make sense to list in our release notes labels Oct 25, 2024
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.28%. Comparing base (3deec23) to head (42eab49).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13920   +/-   ##
=======================================
  Coverage   95.28%   95.28%           
=======================================
  Files        1649     1651    +2     
  Lines       21981    22008   +27     
  Branches     2587     2590    +3     
=======================================
+ Hits        20944    20971   +27     
  Misses        790      790           
  Partials      247      247           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@wrt95 wrt95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant! 👏 Great work 🚀

@wrt95 wrt95 added the skip-manual-testing PRs that do not need to be tested manually label Oct 25, 2024
@framitdavid framitdavid merged commit e371e77 into main Oct 25, 2024
9 checks passed
@framitdavid framitdavid deleted the feat/reusableScopedStorageInterface branch October 25, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend skip-manual-testing PRs that do not need to be tested manually skip-releasenotes Issues that do not make sense to list in our release notes solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-core
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants