microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.59k stars 1.54k forks source link

Refactoring types and action factories from Chat.tsx into their own files #671

Closed compulim closed 7 years ago

compulim commented 7 years ago

Currently, test/history.ts is depending on Store.ts, and is depending on Chat.tsx. And that means our Mocha tests that target Redux, is also loading React code, before running the test in Node.js.

The code in Store.ts that import Chat.tsx is attached below. It is loading some types and action factories.

import { FormatOptions, ActivityOrID, konsole, sendMessage as sendChatMessage } from './Chat';

I think we should put an isolation between Redux and React code by refactoring out types and action factories into their own files.

billba commented 7 years ago

Makes sense. I favor:

compulim commented 7 years ago

That's what I am thinking too.

What do you think about splitting up Store.ts into Actions.ts, ActionFactories.ts, Reducers.ts, and Store.ts?

danmarshall commented 7 years ago

Perhaps Actions.ts might be ReduxActions.ts for disambiguity of BF buttons.

compulim commented 7 years ago

Or in its own folder, like Redux/Store.ts?

billba commented 7 years ago

I like the strategy of not creating more structure than is necessary. There's not really a problem having all the Redux stuff in one file. Makes its easy to jump around between actions and factories and reducers and epics. They're all pretty interrelated. So since it's not causing a problem... I say leave it as it is for now.

compulim commented 7 years ago

Done in #672.