You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the terminal and CTRL + C the running dev server. run npm run build & npm run server
Open the browser console
Click on the Issue entry in the sidebar
Click on the create button
Type a string in the first box. Data arrives in the data provider
Type in the second box. Data does not arrive in the data provider. See that the param in the dataprovider is not logged at all. Most likely because it receives an empty filter object which does not trigger an update?
Related code:
<AutocompleteInputsource="not_working"label="With Symbol"helperText="Filter with symbols work properly. View Console"filterToQuery={(searchText: string)=>{constoriginalFilter={[Symbol('CustomSymbol')]: searchText,};console.log('Symbol Filter returned in filterToQuery',originalFilter);returnoriginalFilter;}}/>
Other information:
Usecase: We use this setup as our filter setup is much more complex and we are supporting pretty much the entire range of SQL filters.
I'll check out the Stackblitz once I the template is workable again. One option would be to forcibly reqrite symbols to be strings instead, but maybe this isn't really worth the effort and I just have to rethink my original approach.
constfilter={normal: "foo",[Symbol("key_sym")]: "bar",};constmakeSymbolsSerializable=(obj: any)=>{//Deep copy probably is overkill replace by Object.entries.reduceconstcloned: Record<string,unknown>=structuredClone(obj);Object.getOwnPropertySymbols(obj).forEach((symbol)=>{cloned[symbol.toString()]=obj[symbol];});returncloned;};console.log(JSON.stringify(makeSymbolsSerializable(filter)));
Symbol support in JS isn't good enough for us to consider it a first-class citizen in filters. I suggest you wait until JSON.stringify() catches up (or submit a patch to v8 to add support yourself) and use constants instead.
So I'll close this issue. Thanks for the report anyway!
What you were expecting:
The object returned from AutocompleteInput's
filterToQuery
function is passed forward to the dataProvider as is.What happened instead:
Properties with a symbol key are missing.
Steps to reproduce:
Due to Stackblitz v4 issue template does not launch sample application #10252 I had to build and run the sample first
Open the terminal and CTRL + C the running dev server. run
npm run build
&npm run server
Open the browser console
Click on the Issue entry in the sidebar
Click on the create button
Type a string in the first box. Data arrives in the data provider
![image](https://private-user-images.githubusercontent.com/9025925/372812689-e46bf533-7663-4353-8d71-972b3898ff69.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNjY3MzQsIm5iZiI6MTczOTA2NjQzNCwicGF0aCI6Ii85MDI1OTI1LzM3MjgxMjY4OS1lNDZiZjUzMy03NjYzLTQzNTMtOGQ3MS05NzJiMzg5OGZmNjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMDIwMDM0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YThkMTM5ZGFiOTM0MzA0ZGFhOTc5ZmIxMzZhZDM1ZTUwNTFmZWQ2N2RkNWFlYTZiYzJjOWExZmY3ZThjYjFlMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.u0y6CsOz0b0Lhq_rEDbza4r6VDB7oRwg077psN-BLcg)
Type in the second box. Data does not arrive in the data provider. See that the param in the dataprovider is not logged at all. Most likely because it receives an empty filter object which does not trigger an update?
Related code:
Other information:
Usecase: We use this setup as our filter setup is much more complex and we are supporting pretty much the entire range of SQL filters.
Without using symbols typescript would complain about index signatures not matching up.
Environment
The text was updated successfully, but these errors were encountered: