Fixed initialization error for realtime remove event #510

Merged
merged 2 commits into from Dec 11, 2013

Projects

None yet

2 participants

Contributor

Symptom: When following the realtime demo here: https://github.com/mde/geddy/wiki/Realtime-and-MVC#lets-generate-an-app and loading up the 'things' index page on two browsers and removing a thing in one browser, this error occurs in the other browser: "Uncaught Error: Syntax error, unrecognized expression: thing-{"model":"Thing","event":"remove"}".

(Realtime events for create and update work perfectly.)

Inspecting the browser side scaffold generated code, it seems that this code is expecting the removed thing's id to be the event argument. Instead it is this: {"model":"Thing","event":"remove"}.

The id never makes it into the object because "data" is undefined at this point in code: https://github.com/mde/geddy/blob/master/lib/app/index.js#L181

My fix corrects this; however, it still does not make an object of the form expected by the browser side generated realtime scaffolding. I now get this error: Uncaught Error: Syntax error, unrecognized expression: #thing-{"id":"D64924A9-8043-48A3-BD64-660AB1CAE891","model":"Thing","event":"remove"}

But at least the id is in the data and I can pull it out and delete the appropriate HTML element loaded in the browser by modifying the generated JavaScript minimally.

Dubious Maximus added some commits Dec 11, 2013
@ben-ng ben-ng merged commit 445708a into geddy:master Dec 11, 2013

1 check passed

default The Travis CI build passed
Details
Contributor
ben-ng commented Dec 11, 2013

Thank you!

@percygrail percygrail deleted the percygrail:rt_remove_fixes branch Dec 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment