Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fetch story): display story data in sidepanel #166

Merged
merged 12 commits into from
Oct 22, 2019
Merged

Conversation

KatvonRivia
Copy link
Member

No description provided.

@KatvonRivia KatvonRivia requested a review from pwambach October 22, 2019 09:27
import {languageSelector} from '../reducers/language';

import {State} from '../reducers/index';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line

}
const StoryItem: FunctionComponent<Props> = ({story}) => (
<Link to={`/stories/${story.id}`}>
<Link to={`/stories/${story.id}/0`}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the /0 now because of the redirect. We don't have to but it looks cleaner :)

useEffect(() => {
storyId && dispatch(fetchStory(storyId));
}, [storyId, dispatch]);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw that we also have to check here if currently loaded story id and storyId from the url are the same. If not we shouldn't render the story. This could happen when someone would switch from one story directly to another. This way the old story is still in the store until the new one if fetched from the server.

import globeReducer from './globe';

const rootReducer = combineReducers({
language: languageReducer,
layers: layersReducer,
stories: storiesReducer,
story: storyReducer,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move all the story related stuff in a subreducer in another PR

import {State} from './index';

export type StoriesState = Story[];
export type StoriesState = StoriesItem[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please rename this to StoryList and StoryListItem and use StoryList everywhere instead of StoriesItem[]

@pwambach pwambach merged commit 6cc8f3a into develop Oct 22, 2019
@pwambach pwambach deleted the feat/fetch-story branch October 22, 2019 13:52
@KatvonRivia KatvonRivia changed the title Feat/fetch story feat(fetch story): display story data in sidepanel Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants