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

Allow initial state function for AoT compatibility #59

Merged
merged 1 commit into from
Jul 9, 2017

Conversation

bfricka
Copy link
Contributor

@bfricka bfricka commented Jul 4, 2017

resolves #51

/// Pretend this is dynamically injected at runtime
const initialStateFromSomewhere = { counter: 3 };

/// Static static

Choose a reason for hiding this comment

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

should be Static state i guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thanks

@bfricka bfricka force-pushed the feature/initial-state-fn branch from 9da06fd to 2087926 Compare July 4, 2017 06:59
@bfricka
Copy link
Contributor Author

bfricka commented Jul 4, 2017

FYI, tests are all passing, but coveralls is throwing a fit.

const initialState = { counter: 2 };

/// In this function dynamic state slices, if they exist, will overwrite static state at runtime.
const getInitialState = () => ({...initialState, ...initialStateFromSomewhere});
Copy link
Member

Choose a reason for hiding this comment

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

This should be exported and a plain function instead of a arrow function for AOT support

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@bfricka bfricka force-pushed the feature/initial-state-fn branch from 2087926 to f5ac836 Compare July 5, 2017 22:53
@brandonroberts brandonroberts self-assigned this Jul 8, 2017
@brandonroberts brandonroberts merged commit 1a166ec into ngrx:master Jul 9, 2017
@brandonroberts
Copy link
Member

Thanks!

@bfricka bfricka deleted the feature/initial-state-fn branch July 10, 2017 17:37
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.

Accept initialState function to allow dynamic initial state in AoT
3 participants