1
這是繼電器突變的代碼,我必須這樣做重新加載,所以商店將與數據庫同步,因爲由於某種原因,如果文本與先前添加的文本繼電器商店相同,則拋出錯誤flattenChildren ...如果在條件不滿足的情況下如果不重複則如何執行函數?
_handleTextInputSave = (text) => {
if(checkIfTextAlreadyExists(text) && window.confirm("Todo already exists! Please confirm to proceed.")) {
AddTodoMutation.commit(
this.props.relay.environment,
text,
this.props.viewer,
);
location.reload();
}
AddTodoMutation.commit(
this.props.relay.environment,
text,
this.props.viewer,
);
};
我想不出其他方式,因爲如果文本已經存在但我覺得AddTodoMutation.commit是多餘的,所以我不得不重新加載。你怎麼看?我會很感激的建議。
是的!我沒有想到那樣。非常感謝你 –