fix: setting list background in store #1616

Merged
konrad merged 4 commits from fix/list-background-store into main 2022-03-27 21:06:30 +00:00
Owner

This PR fixes two bugs when changing list settings, including the background (the background was where it was notable).

Currently, when creating a new list, setting a background and then navigating to the home page, the list background would not be shown in the list card. That was an easy fix.

The second bug: After fixing the first bug the new list background was set on the home page when navigating to the list. This was because the CURRENT_LIST was set to the last visited list, even after the call to this.$store.commit(CURRENT_LIST, null) because everything is async. I tracked the problem down to the call to watchEffect in the ListWrapper component. Apparently, watchEffect is called every time the watched variable is assigned to and not only when it changes. When navigating away from the list, that watcher is getting called with the list id, the one already loaded, and sets it in store which in turn overrides the call from the contentAuth component.

This PR fixes two bugs when changing list settings, including the background (the background was where it was notable). Currently, when creating a new list, setting a background and then navigating to the home page, the list background would not be shown in the list card. That was an easy fix. The second bug: After fixing the first bug the new list background was set on the home page when navigating to the list. This was because the `CURRENT_LIST` was set to the last visited list, even after the call to `this.$store.commit(CURRENT_LIST, null)` because everything is async. I tracked the problem down to the call to `watchEffect` in the ListWrapper component. Apparently, `watchEffect` is called every time _the watched variable is assigned to_ and not only when it changes. When navigating away from the list, that watcher is getting called with the list id, the one already loaded, and sets it in store which in turn overrides the call from the contentAuth component.
konrad requested review from dpschen 2022-02-27 13:32:13 +00:00
Member

Hi konrad!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://1616-fix-list-background-store--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.

Have a nice day!

Beep boop, I'm a bot.

Hi konrad! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://1616-fix-list-background-store--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/. Have a nice day! > Beep boop, I'm a bot.
konrad force-pushed fix/list-background-store from b3ad100db3 to db2005658c 2022-03-27 20:39:08 +00:00 Compare
konrad added 1 commit 2022-03-27 20:40:57 +00:00
continuous-integration/drone/pr Build is passing Details
627d92d5d4
fix: forgotten import
konrad merged commit 46050611d8 into main 2022-03-27 21:06:30 +00:00
konrad deleted branch fix/list-background-store 2022-03-27 21:06:30 +00:00
dpschen reviewed 2022-04-09 22:04:40 +00:00
@ -91,2 +104,4 @@
)
// call the method again if the listId changes
watchEffect(() => loadList(props.listId))

@konrad: reading the comment: shouldn't this be removed?

@konrad: reading the comment: shouldn't this be removed?
Author
Owner

Probably, yes. Not sure why this works with this line still present.

Probably, yes. Not sure why this works with this line still present.

Made a pull request #1795

Made a pull request https://kolaente.dev/vikunja/frontend/pulls/1795
This repo is archived. You cannot comment on pull requests.
No description provided.