Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8299545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:11:37+00:00 2026-06-08T16:11:37+00:00

This is the basic idea of my code. I removed a lot of extra

  • 0

This is the basic idea of my code. I removed a lot of extra stuff from my actual code, but it was mostly css – none of it should have any affect on this…

listRef.on('child_removed', function(childSnapshot, prevChildName) {
    alert('child removed!');
});

listRef.on('child_added', function(childSnapshot, prevChildName) {
    itemRef = childSnapshot.ref();

    alert('child added!);

    itemRef.on('value', function(snapshot){
        alert('item value changed!');

        var name = snapshot.val().name;  // if I remove this line, child_removed is called
        $("#name").html(name);
    });
});

$("#button").click(function() {
    itemRef.remove();
});

The problem is that on $("#button") click, itemRef is removed from listRef in Firebase, but the 'child_removed' event is never triggered… If I take out

driveRef = undefined;

then child_removed is called…

Everything else works – $("#name") is updated and all of the alert() dialogs I am using to test it are working fine – the only problem is child_removed not being called.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:11:39+00:00Added an answer on June 8, 2026 at 4:11 pm

    I think Kato’s comment is right on. If you look in your browser dev tools javascript console, or better yet set it to break on all exceptions (e.g. directions for Chrome), I bet you’ll find your ‘value’ callback is being called with snapshot.val() == null when the child is removed, and so your code throws an exception which is preventing Firebase from raising further events (i.e. your child_removed event).

    We have some feature work planned to make Firebase a little more tolerant of event callbacks throwing exceptions, but for now the fix is to check for snapshot.val() == null in your ‘value’ callback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if this is even possible, but the basic idea of the code
I have some basic idea on how to do this task, but I'm not
This is basic stuff but I can't get this following form to process reliably.
This basic app which was given to me as an project should run quite
Hi I have this basic random quote script, but I would like it to
Forgive my ignorance in asking this basic question but I've become so used to
I'm trying to learn this basic thing about processors that should be taught in
I have some code in a common library to support internationalization. The basic idea
The basic idea is this: I have a form that generates form fields dynamically
Basic idea of my if else statements is this: If .wrap is parent element:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.