denoland / deno_blog

Minimal boilerplate blogging.
MIT License
477 stars 100 forks source link

fix: middleware order #92 #93

Closed s-uei closed 1 year ago

crowlKats commented 1 year ago

what does this fix?

s-uei commented 1 year ago

I want to fix the order of calling middlewares. Now it changes by loading page. https://github.com/denoland/deno_blog/issues/92

lino-levan commented 1 year ago

LGTM! PTAL, @crowlKats.

s-uei commented 1 year ago

LGTM! Minor issue, but it may be me only: the slice call's intentions were a bit confusing at first -- would a spread operator be more clear to its intentions of cloning the array?

I agree but I cannot write good vibes code because state.middlewares maybe undefined.

const mws = state.middlewares ? [...state.middlewares].reverse() : undefined
LeoDog896 commented 1 year ago

Ah, makes sense, thanks for the clarification!