loaders.gl icon indicating copy to clipboard operation
loaders.gl copied to clipboard

fix(RequestScheduler): Fix&improve GetPriorityFun signature

Open zbigg opened this issue 2 years ago • 4 comments

Fix and then improve type signature of getPriority parameter of RequestScheduler.scheduleRequest, so it accepts generic Handle.

See: https://github.com/visgl/deck.gl/pull/6841/files#r866184522

zbigg avatar May 05 '22 18:05 zbigg

Have you run tests on it? I guess it causes errors in existing code.

Yes i've ran tests (yarn test) and full build (yarn build). Do you have hints where to look for code that breaks?

zbigg avatar May 05 '22 18:05 zbigg

Is it OK not to use generic here: https://github.com/visgl/loaders.gl/blob/f030d39d5cdedb137e43e757a9da10dd637857fd/modules/tiles/src/tileset/tileset-3d.ts#L296 ?

belom88 avatar May 05 '22 18:05 belom88

Is it OK not to use generic here:

https://github.com/visgl/loaders.gl/blob/f030d39d5cdedb137e43e757a9da10dd637857fd/modules/tiles/src/tileset/tileset-3d.ts#L296

?

I meant https://github.com/visgl/loaders.gl/blob/f030d39d5cdedb137e43e757a9da10dd637857fd/modules/tiles/src/tileset/tile-3d.ts#L376 . As I can see because of type Handle = any; that includes undefined it doesn't break code here.

belom88 avatar May 05 '22 19:05 belom88

Is it OK not to use generic here: this._getPriority.bind(this)

Yes, this is ok. RequestScheduler puts handle as hint for getPriority and it is free to use it to calculate priority or ignore completely. In this case, TileHeader._getPriority is already bound to its context via this,so it is free to ignore handle given by param.

Summarising, this typing update doesn't change anything in "currently" allowed behavior, it's just aligns typing with implementation and with current usage.

zbigg avatar May 05 '22 19:05 zbigg

Close due to inactivity

ibgreen avatar Apr 02 '24 20:04 ibgreen