Skip to content

Commit cd32597

Browse files
committed
Fixed broken favourites in code editor
1 parent 8594656 commit cd32597

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

resources/js/components/code-editor.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,13 @@ export class CodeEditor extends Component {
7474

7575
onChildEvent(button.parentElement, '.lang-option-favorite-toggle', 'click', () => {
7676
isFavorite = !isFavorite;
77-
const action = isFavorite ? this.favourites.add : this.favourites.delete;
78-
action(language);
77+
78+
if (isFavorite) {
79+
this.favourites.add(language);
80+
} else {
81+
this.favourites.delete(language);
82+
}
83+
7984
button.setAttribute('data-favourite', isFavorite ? 'true' : 'false');
8085

8186
window.$http.patch('/preferences/update-code-language-favourite', {

0 commit comments

Comments
 (0)