vue-request icon indicating copy to clipboard operation
vue-request copied to clipboard

fix: undefined injectedGlobalOptions close #182

Open LuXDAmore opened this issue 1 year ago • 8 comments

fix: undefined injectedGlobalOptions close #182

LuXDAmore avatar Jan 08 '24 10:01 LuXDAmore

Can you provide a reproducible example?

John60676 avatar Jan 09 '24 02:01 John60676

@John60676 So, I don't know exactly how to reproduce it and probably it's not a problem of vue-request.. After digging I've found that is related to Nuxt and to this bug

Because moving the usePagination() BEFORE the await useAsyncData() fix the problem.

So i think in some ways the inject lose its context after the await so the undefined injectedGlobalOptions error appear in the console and is annoying.

LuXDAmore avatar Jan 09 '24 11:01 LuXDAmore

when usePagination used in typescript or JavaScript, inject will return undefined。

neostfox avatar May 09 '24 11:05 neostfox

I think use renderless component is much better than provide/inject

neostfox avatar May 09 '24 11:05 neostfox

@LuXDAmore @John60676 @neostfox , so everyone? how to fix this? i have this problem when implementing ant-design-vue ajax table in vue js and i can't found any related post/thread except this

sugionosihuahua avatar Jul 03 '24 07:07 sugionosihuahua

@sugionosihuahua for me the solution was to move the usePagination() BEFORE every others await used in the component.

LuXDAmore avatar Jul 03 '24 09:07 LuXDAmore

@LuXDAmore thx for the reply, however in my case this happened because i put data result inside another array in the backend response (same as documentation in the ant-design-vue table, they put data in the "results" key). so now i can do just fine.

sugionosihuahua avatar Jul 03 '24 15:07 sugionosihuahua

i also meet the problem, plz merge the pr

code-lixm avatar Jul 26 '24 04:07 code-lixm