Skip to content

Clean up on style options vs. props #2310

@compulim

Description

@compulim

Version

master

Describe the bug

Our React context (namely, Composer.js) and Redux store is kind of a bin to throw stuff at, we didn't clear up the responsibility of each. Also same for style options vs. props.

### React Context vs. Redux store

Redux store should only hold UI-agnostic content, for example, activities. It should not hold UI features, like language. Redux store is designed to be able to bring in independently to React Native. Or maybe Angular thru NgRx, but not guaranteed.

React store should keep UI features, like language and which activities has been spoken.

Things keep in Redux store can go thru de/hydration loop. Think about survivability across F5. Speech synthesis doesn't meet this bar (not desirable to be survived).

Style options vs. props

Style options is designed to be a flat dictionary and easily serializable as query string. We should keep styles in it, including temporary styles, for example, groupTimestamp and sendTimeout. The only exception is disabled, because it is React convention.

Props keep things unrelated to styling, for example, Redux store, renderer middleware, ponyfills. Usually, they are heavy objects or functions.

What is not great today

This listing is for stuff that are not great.

  • Connect to Direct Line
    • May be this is inevitable, must be part of initialization
  • Send timeout could be part of the style options
    • Arguably, when to show the "retry" prompt is a styling things, not a logic currently
    • Store is not interested in retry and is not aware of retry logic
      • Yes, we don't have a good retry story, we can't retry postBack and messageBack

[Bug]

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogOut of scope for the current iteration but it will be evaluated in a future release.bugIndicates an unexpected problem or an unintended behavior.front-burnerp1Painful if we don't fix, won't block releasing

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions