fix(ready): remove class from fragment #1276

Merged
dpschen merged 1 commits from dpschen/frontend:featur/fix-remove-class-from-fragment into main 2022-01-04 20:34:34 +00:00
Member

The <ready> component is a fragment (has multiple root nodes). Fragments do not support classes set from outside.

The `<ready>` component is a fragment (has multiple root nodes). Fragments do not support classes set from outside.
dpschen added the
kind/bug
label 2022-01-01 12:44:28 +00:00
konrad was assigned by dpschen 2022-01-01 12:44:28 +00:00
dpschen force-pushed featur/fix-remove-class-from-fragment from 8a4d104b39 to 715120d1be 2022-01-01 12:48:06 +00:00 Compare
dpschen requested review from konrad 2022-01-01 12:48:26 +00:00
dpschen changed title from fix(ready): remove class form fragment to fix(ready): remove class from fragment 2022-01-03 15:18:54 +00:00
Member

Hi dpschen!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://1276-featurfix-remove-class-from-fragment--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 dpschen! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://1276-featurfix-remove-class-from-fragment--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 reviewed 2022-01-03 21:16:08 +00:00
src/App.vue Outdated
@ -1,5 +1,6 @@
<template>
<ready :class="{'is-touch': isTouch}">
<ready>
<div :class="{'is-touch': isTouch}">

Do we really need that extra div?

Do we really need that extra div?
Author
Member

It's necessary in the sense that we currently don't have a wrapper div around the app that we could use to add a class (in this case is-touch) because ready is as said a fragment.

But instead of adding a additional div we can also add this class to the body tag. Will do this instead.

It's necessary in the sense that we currently don't have a wrapper div around the app that we could use to add a class (in this case `is-touch`) because `ready` is as said a fragment. **But** instead of adding a additional div we can also add this class to the body tag. Will do this instead.
dpschen marked this conversation as resolved
dpschen force-pushed featur/fix-remove-class-from-fragment from 715120d1be to 256bf524fe 2022-01-04 16:23:09 +00:00 Compare
dpschen force-pushed featur/fix-remove-class-from-fragment from 256bf524fe to d178bdeb72 2022-01-04 16:29:00 +00:00 Compare
dpschen force-pushed featur/fix-remove-class-from-fragment from d178bdeb72 to 5447147c52 2022-01-04 18:46:03 +00:00 Compare
dpschen force-pushed featur/fix-remove-class-from-fragment from 5447147c52 to ad9bbc71d7 2022-01-04 18:56:28 +00:00 Compare
dpschen force-pushed featur/fix-remove-class-from-fragment from ad9bbc71d7 to c0c0900290 2022-01-04 18:57:06 +00:00 Compare
konrad reviewed 2022-01-04 20:07:34 +00:00
src/App.vue Outdated
@ -1,16 +1,14 @@
<template>
<ready :class="{'is-touch': isTouch}">
<div :class="{'is-hidden': !online}">

What about this? Is the banner still shown when the user goes offline?

What about this? Is the banner still shown when the user goes offline?
Author
Member

Because of these code lines in the <ready> component the is-hidden class is useless since the slot content would never mount if the user is offline:

	<div class="app offline" v-if="!online">
		<div class="offline-message">
			<h1>{{ $t('offline.title') }}</h1>
			<p>{{ $t('offline.text') }}</p>
		</div>
	</div>
	<template v-else-if="ready">
		<slot/>
	</template>
Because of these code lines in the `<ready>` component the `is-hidden` class is useless since the slot content would never mount if the user is offline: ```vue <div class="app offline" v-if="!online"> <div class="offline-message"> <h1>{{ $t('offline.title') }}</h1> <p>{{ $t('offline.text') }}</p> </div> </div> <template v-else-if="ready"> <slot/> </template> ```

Ah, makes sense! I guess this is an old one from before the ready component.

Ah, makes sense! I guess this is an old one from before the ready component.
konrad marked this conversation as resolved
@ -0,0 +1,16 @@
import {ref, watchEffect} from 'vue'
import {tryOnBeforeUnmount} from '@vueuse/core'
export function useBodyClass(className: string, defaultValue = false) {

Nice one!

Nice one!
dpschen marked this conversation as resolved
konrad approved these changes 2022-01-04 20:13:42 +00:00
konrad left a comment
Owner

Should be fine once the conflicts are resolved.

Should be fine once the conflicts are resolved.
dpschen force-pushed featur/fix-remove-class-from-fragment from c0c0900290 to 29d8422e94 2022-01-04 20:15:13 +00:00 Compare
dpschen merged commit 29d8422e94 into main 2022-01-04 20:34:34 +00:00
dpschen deleted branch featur/fix-remove-class-from-fragment 2022-01-04 20:34:34 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.