Load record from server when data comes from pusher for the 1st time

Pusher events usually does not have all data that's needed and ember
will not automatically refresh record to load missing data. That's why
it's easier to fetch record information directly from API for the first
time, even if it comes from pusher.
This commit is contained in:
Piotr Sarnacki 2012-08-09 17:55:17 +02:00
parent 7abdd1cf33
commit b61f79545b
2 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,11 @@ Travis.Store = DS.Store.extend
if record = recordCache[clientId]
record.send('didChangeData')
else
clientId = @pushHash(hash, id, type)
# that's nasty, but will do for now
# if event is triggered for a record
# that's not yet available, just use find
# to make a request to fetch it
@find(type, id)
DATA_PROXY.savedData = hash
@updateRecordArrays(type, clientId, DATA_PROXY)

File diff suppressed because one or more lines are too long