[MGNLFE-560] Support another way to share data between components Created: 05/Jul/23  Updated: 18/Sep/23  Resolved: 31/Aug/23

Status: Closed
Project: Magnolia Frontend Helpers
Component/s: None
Affects Version/s: None
Fix Version/s: 1.6

Type: Story Priority: Neutral
Reporter: Oanh Thai Hoang Assignee: Phong Le Quoc
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: 0d Remaining Estimate: 0d
Σ Time Spent: 5d 1h Time Spent: 4.25d
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
documentation
to be documented by MGNLFE-628 DOC: Describe React SharedContext Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLFE-613 Implement Sub-task Closed Phong Le Quoc  
MGNLFE-614 Review Sub-task Closed Oanh Thai Hoang  
MGNLFE-615 PiQA Sub-task Closed Oanh Thai Hoang  
MGNLFE-616 QA Sub-task Closed Anh Vu  
MGNLFE-622 Prepare a sample next 13 project for ... Sub-task Closed Oanh Thai Hoang  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Epic Link: React RSC
Sprint: DevX 44, DevX 45
Story Points: 5
Team: DeveloperX
Work Started:
Approved:
Yes

 Description   

Besides react built-in context (React.createContext()), supports another way by using a global singleton that can share data between components:

  • Consider moving unchanged data in 1 js singleton (componentMappings, fallbackComponent, devMode)
  • And easy changed data in another js (content from page, templateAnnotations)

 

 

AC: Check and update all sample spa project that used EditorContext.js

 

Reference code: ComponentConfig.js, ContextSingleton.js from propsal PR: https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/pull-requests/220/diff#samples/next-js-13-with-react-editor-new/packages/react-editor-2/src/utils/ContextSingleton.js


Generated at Mon Feb 12 05:48:37 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.