sanity icon indicating copy to clipboard operation
sanity copied to clipboard

fix(core): move `ToastProvider` inside `LocaleProvider`

Open juice49 opened this issue 5 months ago • 3 comments

Description

This change fixes a bug that occurs when a Toast component contains a Translate component, because the Translate component now depends on LocaleContext.

Notably, this occurs when some document operations (e.g. publication) succeed.

This is caused by the order of the providers. ToastProvider is a parent of LocaleProvider, but it needs to be a descendant of it. This branch adjusts the order of the providers in order to fix the problem.

What to review

  • We've moved ToastProvider down the tree. It doesn't appear anything further up the tree depends on it. Is that correct?
  • We've moved ErrorLogger down the tree (because it depends on ToastProvider); notably, it is now inside StudioErrorBoundary. Are there any concerns with that?

Testing

  • Existing Studio e2e tests.
  • Manually testing Studio.

Notes for release

  • Fixes a bug that caused Studio to crash if a Translate component appeared inside a Toast component.

juice49 avatar Mar 28 '24 17:03 juice49