Help forum
Practices for creating test data for dynamic context while working in the editor.
I have tried to create a simple global formula for providing test data to components that rely on dynamic context data . I 'm using this function for things like API calls , local storage , and page parameters to have some 'dummy data ' while working on my components . My question is : would this be considered bad practice , or are there alternative approaches I should consider ? That ’s an interesting approach , Alfred . Personally speaking , I would always be cautious with keeping test data in the app just in case it makes its way to the db , local storage , etc . , somehow in production . I tend to create test data in a branch when working on something (it ’s often needed if the data is dynamic ) and then remove it prior to publishing . This way , I know it ’s never going to reach the main branch . You could also have a branch that always contains the test data and copy /paste when working on something . Probably a few ways to skin a cat there . Alternatively , you could use your db to store test data and utilise that . It ’s hard to tell as there ’s no specific use -case but I hope that ’s helpful . I asked ChatGPT and got this , which confirms feature flags , conditional logic or git branches is probably a good approach . 👍1
