Is it possible to unlink a linked record using the Relay Modern imperative mutation API? - relayjs

I would like write a mutation updater that unlinks a linked record from another record.
For example, suppose I have the following in my store:
client:root {
user: {__ref: "someid"}
}
I am looking for a way to unlink user and client:root. user is a nullable field. I would like subscribers that are interested in the user field to see it has gone null.
Right now the only way I am seeing to unlink this field is to delete the node from the store. I've tried setting the link to null using setLinkedRecord but that throws an error.

.setLinkedRecored() expects the first argument to be an instance of RecordProxy. Use .setValue() for unlinking nodes, as whitep4nther commented above.
store.getRoot().setValue(undefined, 'user');

I was just fighting with this as well, and after digging through the relay codebase, I decided there isn't an appropriate way to go about this right now. I've opened an issue here.

Related

How to do it in Grails , I am using Grais 3.2.11?

I have a User domain and several other domains having userId .
How can I clear them all while deleting user? Without manually finding it one by one in other domains and removing it.
You need to make sure you have defined the right cascade and ownerships for your domain classes and then grails will do this for you.
I think the entry in official documentation about cascade describes your issue exactly, check it: http://docs.grails.org/3.2.1/ref/Database%20Mapping/cascade.html
You can do that without full reference(so it should be instead of Long userId be User user that delete it)
But if you are looking for a hack, so you can get all domains and filter they by field userId, then find all by current userId and remove they.
Take a look on grailsDomainClassMappingContext, PersistentEntity, PersistentProperty

Enteprise Architect element MiscData(0) change (PDATA1)

I guess it's a simple question, but i still couldn't figure out how can i change the PDATA1/MiscData(0) property of an element via Add-In (and not by SQL Update). The problem is that the documentation says the MiscData is read-only.
Basically i am trying to make a hyper-link on a diagram with the help of an Add-In.
I create a simple Text typed EA.Element, then an EA.DiagramObject, connect them via ElementID and i need this Text typed object to point to an exact diagram.
What i know is that a hyper-link is a Text typed object with PDATA1 filled in with the wanted diagram's ID. The created element's Notes is already filled with a valid hyperlink's value like: packageName : diagramName.
I'm interested in any other ways to make a working hyper-link with the help of an Add-In.
Thanks in advance for the answer!
Tamas
You need to call
Repository.Execute("UPDATE t_object set PDATA1 ...")
Execute is an undocumented but ever since working last resort. Nobody knows why MiscData is r/o.
In oder to make the changes visible on the diagram you need to call
Repository.ReloadDiagram (diagram.DiagramID)
Since EA will eventually pop-up a save-window for modified diagrams you should eventually call
Repository.SaveDiagram (diagram.DiagramID)
prior to the reload.
Important note: You need to remember that the Execute bypasses the API. If you have diagram changes and call Execute on diagram objects they need to be saved before. EA only updates all changed diagram objects in the database when the whole diagram is saved (manually or via SaveDiagram).

ZenDesk - How to update a field on user/organization update

I am trying to figure out how to update a ZenDesk custom field when the user or organization has been updated. I've read through the docs, I've tried everything I can think of... All to no avail... Below is the basics of what I want to do:
When any User or Organization has been updated (there has to be some function running as the record updates every time I blur() from a field) I want to check a custom checkbox that is on the same record. Problem is, I can't find anything that triggers when the record is updated (via a ZAT app).
I tried using organization..changed:function(){}. That worked to set the field, sort of. I tried the following code, which checks the box then immediately unchecks the box??? Any thoughts at all on this? Thanks!
events:{
'organization.last_edited_by.changed':'markOrgSend'
},
markOrgSend:function(e){
var organization=this.organization();
organization.customField("update_checkbox",true);
}
Thanks for any insight into how to catch the update/save action for User/Organization records.
What about something like this?
'ticket.assignee.user.id.changed': 'markOrgSend',
'ticket.organization.id.changed': 'markOrgSend'

Ruby on Rails: What is stale object and it's features?

In my application i got the error as con't update stale object. I don't know about this object. When it will create and why it was called a stale object. I want to know. Is it used in Only in ROR or other languges are also uses, this object and purpose?
According to the documentation:
http://api.rubyonrails.org/classes/ActiveRecord/StaleObjectError.html
Reason of Stale object exception is:
Record is stale when it's being saved in another query after instantiation, for example, when two users edit the same wiki page and one starts editing and saves the page before the other.
Solution: To avoid this exception use the locking system:
http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
In my application multiple threads to be able to edit the same work -> version -> element record. its detecting error and raising the suitable error.
I typically did to handle the error:
I print a flash message such as "Sorry, please try after someone time, someone else editing this working version element".
element.lock_version = Document::Element.find(element.id).lock_version
element.save!
For example, such as detecting that one edit changed the element's type, where as the other edit changed the element's name by different creator, and then code of the two record should be merged done in one save.
In general, I used to element.reload to fetch a fresh version of the element.
worked fine!!

Sharing an object in simperium, write_access doesnt do anything

I have created two users, and if i create a bucket for one user and an object inside that bucket i can share it using the HTTP api at the moment.. see here
https://simperium.com/docs/reference/http/#objectshare
However, even when i sent through "write_access" = true and get a 200 as a result, it doesnt seem to let me write to it.
Its only if i enable sharing back the other way that it allows data to sync both ways, am i doing something wrong?
Has collaboration got any further yet? i can see there is a long but no docs as yet? anyone know?
After some more trial & error, I found the solution:
to edit the shared object, the target user (ie the user that the object was shared with) needs to use an objectId that is equal to: <original_user_simperiumId>/<original_objectId> to edit the object.
If you just use <original_objectId> it won't work.
So the full command for editing a shared object, using curl:
curl -H 'X-Simperium-Token: {auth_token_of_target_user}' https://api.simperium.com/1/{appID}/{entity}/i/{original_user_simperiumId>/{original_objectId} -d '{"data_key" : "new_data_value"}'

Resources