Commit 077ec4d0 authored by Kyle Keating's avatar Kyle Keating

Namespace the real-time-updates module

parent 5552dbfc
...@@ -138,7 +138,7 @@ function clearPendingUpdates() { ...@@ -138,7 +138,7 @@ function clearPendingUpdates() {
* @return {{[id: string]: Annotation}} * @return {{[id: string]: Annotation}}
*/ */
function pendingUpdates(state) { function pendingUpdates(state) {
return state.pendingUpdates; return state.realTimeUpdates.pendingUpdates;
} }
/** /**
...@@ -148,14 +148,17 @@ function pendingUpdates(state) { ...@@ -148,14 +148,17 @@ function pendingUpdates(state) {
* @return {{[id: string]: boolean}} * @return {{[id: string]: boolean}}
*/ */
function pendingDeletions(state) { function pendingDeletions(state) {
return state.pendingDeletions; return state.realTimeUpdates.pendingDeletions;
} }
/** /**
* Return a total count of pending updates and deletions. * Return a total count of pending updates and deletions.
*/ */
const pendingUpdateCount = createSelector( const pendingUpdateCount = createSelector(
state => [state.pendingUpdates, state.pendingDeletions], state => [
state.realTimeUpdates.pendingUpdates,
state.realTimeUpdates.pendingDeletions,
],
([pendingUpdates, pendingDeletions]) => ([pendingUpdates, pendingDeletions]) =>
Object.keys(pendingUpdates).length + Object.keys(pendingDeletions).length Object.keys(pendingUpdates).length + Object.keys(pendingDeletions).length
); );
...@@ -165,11 +168,12 @@ const pendingUpdateCount = createSelector( ...@@ -165,11 +168,12 @@ const pendingUpdateCount = createSelector(
* has not yet been applied. * has not yet been applied.
*/ */
function hasPendingDeletion(state, id) { function hasPendingDeletion(state, id) {
return state.pendingDeletions.hasOwnProperty(id); return state.realTimeUpdates.pendingDeletions.hasOwnProperty(id);
} }
module.exports = { module.exports = {
init, init,
namespace: 'realTimeUpdates',
update, update,
actions: { actions: {
receiveRealTimeUpdates, receiveRealTimeUpdates,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment