Fabric: Making `State::getMostRecentState` public
Summary: That was always part of design, that's okay to get a newer state from any other state. We will need it in the future diffs. Reviewed By: sammy-SC Differential Revision: D17053429 fbshipit-source-id: 2174e7d6e3a1ed231f7f6e238d216d0b09ec8797
This commit is contained in:
Родитель
876a2789db
Коммит
33112a1c20
|
@ -122,7 +122,7 @@ const State::Shared &ShadowNode::getState() const {
|
|||
|
||||
State::Shared ShadowNode::getMostRecentState() const {
|
||||
if (state_) {
|
||||
auto commitedState = state_->getCommitedState();
|
||||
auto commitedState = state_->getMostRecentState();
|
||||
|
||||
// Commited state can be `null` in case if no one node was commited yet;
|
||||
// in this case we return own `state`.
|
||||
|
|
|
@ -30,7 +30,7 @@ void State::commit(const ShadowNode &shadowNode) const {
|
|||
stateCoordinator_->setTarget(StateTarget{shadowNode});
|
||||
}
|
||||
|
||||
State::Shared State::getCommitedState() const {
|
||||
State::Shared State::getMostRecentState() const {
|
||||
auto target = stateCoordinator_->getTarget();
|
||||
return target ? target.getShadowNode().getState()
|
||||
: ShadowNodeFragment::statePlaceholder();
|
||||
|
|
|
@ -28,6 +28,13 @@ class State {
|
|||
explicit State(StateCoordinator::Shared const &stateCoordinator);
|
||||
virtual ~State() = default;
|
||||
|
||||
/*
|
||||
* Returns a momentary value of the most recently committed state
|
||||
* associated with a family of nodes which this state belongs to.
|
||||
* Sequential calls might return different values.
|
||||
*/
|
||||
State::Shared getMostRecentState() const;
|
||||
|
||||
#ifdef ANDROID
|
||||
virtual const folly::dynamic getDynamic() const;
|
||||
virtual void updateState(folly::dynamic data) const;
|
||||
|
@ -45,11 +52,6 @@ class State {
|
|||
*/
|
||||
void commit(const ShadowNode &shadowNode) const;
|
||||
|
||||
/*
|
||||
* Must be used by `ShadowNode` *only*.
|
||||
*/
|
||||
State::Shared getCommitedState() const;
|
||||
|
||||
/*
|
||||
* Indicates that the state was committed once and then was replaced by a
|
||||
* newer one.
|
||||
|
|
Загрузка…
Ссылка в новой задаче