Skip to content

Vue migration to composition api#2464

Open
linusbbb wants to merge 15 commits into
eclipse-set:mainfrom
linusbbb:vue-migration-to-composition-api
Open

Vue migration to composition api#2464
linusbbb wants to merge 15 commits into
eclipse-set:mainfrom
linusbbb:vue-migration-to-composition-api

Conversation

@linusbbb

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread web/siteplan/src/components/development/FeatureSearch.vue Outdated
Comment thread web/siteplan/src/components/development/FeatureSearch.vue Outdated
Comment thread web/siteplan/src/components/development/FeatureSearch.vue Outdated
@linusbbb linusbbb requested a review from mariusheine June 4, 2026 05:57
Comment on lines +89 to +92
const featureLayers = ref([]) as Ref<NamedFeatureLayer[]>
const dragTargetLayer = ref(null) as Ref<NamedFeatureLayer | null>
const dragInsertBefore = ref(false)
const draggedLayer = ref(null) as Ref<NamedFeatureLayer | null>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb Use generics instead of type casts

Suggested change
const featureLayers = ref([]) as Ref<NamedFeatureLayer[]>
const dragTargetLayer = ref(null) as Ref<NamedFeatureLayer | null>
const dragInsertBefore = ref(false)
const draggedLayer = ref(null) as Ref<NamedFeatureLayer | null>
const featureLayers = ref<NamedFeatureLayer[]>([])
const dragTargetLayer = ref<NamedFeatureLayer | null>(null)
const dragInsertBefore = ref(false)
const draggedLayer = ref<NamedFeatureLayer | null>(null)

Comment on lines +116 to +121
onBeforeUnmount(() => {
if (unsubscribe) {
unsubscribe()
}
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb PLease revert the order here because it was not relevant

Comment on lines +48 to +55
function getType (lockkey: LockKey) {
switch (lockkey.type) {
case LockKeyType.Inside:
return 'innen'
case LockKeyType.Outside:
return 'aussen'
default:
return ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb This should become a computed which makes it easier to debug and a bit more performant

Comment on lines -100 to -102
if (getFeatureType(this.selectedFeature) === FeatureType.Flash) {
this.selectedFeature = (getFeatureData(this.selectedFeature) as FlashFeatureData).refFeature
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb This if is missing in the new implementation. Why? Or just accidental?

Comment on lines +162 to 168
function getFeatureName (feature: Feature<Geometry>): string {
return getFeatureNameOfType(getFeatureType(feature))
}

#menuItem {
cursor: pointer;
margin-bottom: 5px;
border-radius: 10px;
background-color: gainsboro;
padding-left: 5px;
function getLabel (feature: Feature<Geometry>): string {
return getFeatureLabel(feature)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb With the new setup script we don't need these wrapper functions but can directly use the imported functions in the template.

onMounted(() => {
const mode = route.query.mode
if (mode) {
const ele = document.getElementById(mode.toString())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb I thought we wanted to get rid of this as well by setting an active class on the list item that matches the given mode? Or do I remember wrong?

mounted (): void {
this.developmentOptions = Configuration.developmentMode()
}
const emit = defineEmits(['show-menu'])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb Safer emits declaration

Suggested change
const emit = defineEmits(['show-menu'])
const emit = defineEmits<{ 'show-menu': [value: boolean] }>()

this.$emit('showMenu', false)
this.menuBtnColor = ''
this.$router.push('/')
watch(router.currentRoute, currentRoute => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb Instead of router.currentRoute use const route = useRoute() like you did in other components. This also requires some changes in the code below


const isDevelopmentMode = Configuration.developmentMode()
const map: OlMap = store.state.map
const mapRoot = ref<HTMLDivElement | null>(null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb Use useTemplateRef here

return scaleLine!.getScaleForResolution()
}

onMounted((): void => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusbbb Please readd the comments in this function again so that we still get the context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants