I have this Jetstream Laravel application, which has a presence channel set up for chat features.
What's happening is:
When I join the channel and send a message there, everything works fine, except when I try to exit the channel. In every navigation link, the error Uncaught DOMException: Failed to execute 'replaceState' on 'History': #<Object> could not be cloned. is triggered.
Not sure what is causing it...
Curious Fact:
When I join the channel, and leave it, without sending any message, it works as expected. I visit the page that I was supposed to visit, without any error.
You should not change the props who is coming from $page.props.{propName}
Instead if you want to make some changes on a prop like your app {messages}
you should create a new object or array from the prop:
const messages = ref([...page.props.value.messages]);
Now you can change the messages object as many as you want:
messages.push(newMessage)
Related
the mAuth and mCallbacks object is giving red-font-error. How to resolve this?
Do I need to make the object outside of the codeblock?
here is the code block in which the red-font errors are showing up:
PhoneAuthOptions options =
PhoneAuthOptions.newBuilder(mAuth)
.setPhoneNumber(phoneNumber) // Phone number to verify
.setTimeout(60L, TimeUnit.SECONDS) // Timeout and unit
.setActivity(this) // Activity (for callback binding)
.setCallbacks(mCallbacks) // OnVerificationStateChangedCallbacks
.build();
PhoneAuthProvider.verifyPhoneNumber(options);
If you keep following the documentation on implementing phone authentication on Android, you'll see that the mCallbacks object is defined in the next step, right under the code you have above. It is explained as:
When you call PhoneAuthProvider.verifyPhoneNumber, you must also provide an instance ofOnVerificationStateChangedCallbacks, which contains implementations of the callback functions that handle the results of the request.
Under that explanation is a code sample, and then an explanation of each individual callback and its purpose.
I recommend reading the entire page first, so that you understand the complete flow, and only then starting to copy/paste the relevant code snippets.
I am trying to remove/delete items from my Firebase Database onPress of a button. The following is my code for the method I'm using to attempt to remove the item.
let itemsRef = db.ref('/items');
handleRemove = (item) => {
itemsRef.remove({
name: item
});
}
My method for remove is the same implementation of the push method that adds items to the database.
I get an error stating that - "Error: Reference.remove failed: first argument must be a valid function"
See image of error screen
The remove method doesnt take an object as a parameter. You should only do this:
itemsRef.remove();
From the docs:
remove
remove(onComplete?: function): Promise
Removes the data at this Database location.
Any data at child locations will also be deleted.
The effect of the remove will be visible immediately and the corresponding event 'value' will be triggered. Synchronization of the remove to the Firebase servers will also be started, and the returned Promise will resolve when complete. If provided, the onComplete callback will be called asynchronously after synchronization has finished
I have a container that I want to prevent from being deleted if there are contents in it. Like if they hit delete under actions and hit confirm, a status message or an exception message (ala Insufficient Priviliges) could appear.
I thought maybe using an event subscriber like IObjectWillBeRemovedEvent and IObjectRemovedEvent and raising an exception message if there were contents in the container would work, but it went ahead and deleted the container without any error message displaying.
#grok.subscribe(IMyContainerType,IObjectRemovedEvent (or IObjectWillBeRemoved))
def timesheetDeletion(obj,event):
if len(obj.getFolderContents()) > 0:
raise LinkIntegrityNotificationException('There are contents in this container. To maintain integrity of aggregation, please delete contents first')
I'm not sure if that's the right exception, but I keep on coming cross that being used in topics and questions related to preventing an object from being deleted.
I can't help but feel that there must be a simpler way to do this, perhaps without needing an event, but I'm not sure what to do.
I have noticed something really embarrassing with Meteor. When an error occurs inside a method on the server, this makes the entire code of the method to be rerun. This can lead to some unexpected results and some kind of trouble. For instance:
Meteor.methods
'someMethod': ->
# we insert an element in the database
Collection.insert({ record: "We want this record to be inserted only once." })
# We just made a mistake here, let's say that the object is not defined.
variable = object.property
return variable
What happened in my case is that Meteor throws an error saying that it cannot read the property of undefined (I can see it within the server logs) and then rerun the code of the method repeatedly throwing the same error again. I can see a lot of records inserted on my database when it should have one.
I don't know if there is a way to ask meteor to not rerun the code when an error occurs or some kind of thinking I need to learn while developing an application with it.
I'm getting error while running a game I created with flex.
I know there has been some question about this, but my case is quite weird. I created a simple typing game that is running OK on my computer, but when I tried to deploy it online to facebook, I got those errors. I used code from the tutorial from adobe here http://www.adobe.com/devnet/facebook/articles/flex_fbgraph_pt4.html to deploy my flex game to facebook
This is the error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FacebookUserStatusWeb/init()
at FacebookUserStatusWeb/___FacebookUserStatusWeb_Application1_creationComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/set initialized()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
And here is snippet of the init() function:
protected var text1:String="Text to be typed"; //hard-coded temporarily
protected const TIMER_INTERVAL:int = 10;
protected var t:Timer = new Timer(TIMER_INTERVAL);
protected var topURL:String=ExternalInterface.call('top.location.toString');
protected function init():void
{
t.addEventListener(TimerEvent.TIMER, updateTimer);
ProblemText.text = new String(text1);
Facebook.init("<my app id>",loginHandler);
currentState = (topURL) ? "loggedout": "loggedoutonfacebook";
}
Some notes:
1.my app id is my facebook app id which I prefer not to show
2.ProblemText is a richtext which I placed the paragraph to be typed by the player.
3.I have deleted the method Application1_creationComplete() but it still appears at the error listing
And also I am curious about the errors other than the first two. What do they mean?
Ah, and if it is helpful, I can post some more of the code
First: You're only seeing one error. Everything you see below the #1009 error is your stack trace, not additional errors.
The stack trace basically tells you the series of things that happened prior to the error occurring, with the most recent at the top. This is useful because often things which happen prior to the actual error you see will contribute to said error.
Second: The null object reference is occurring because something in your init() function tried to access a property in an object that doesn't exist, or an object that doesn't exist. One (slightly messy but effective) way to debug this would be to drop some trace statements in the code to see how far it gets before barfing with the error -- the idea being to isolate the specific line that's causing the problem. Once you've done that, you need to work backwards to figure out why the object or property you're trying to use is null. It could be something simple, like a typo, or it could be more complex. You'll have to sleuth it out, one way or another =)
Good luck!
Finally got the bug. Just in case people have the same case with me, what exactly happened is at my computer I simulated the game with just one state, but when I'm deploying to facebook I have several states (loggedin,loggedout,etc). In the init() I tried to access ProblemText Label that is not present in the current state.