We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
每次打开 TypeGridFilterCmp 组件,值都是 空 '', 请问为什么呀?
import { Remesh } from 'remesh'; export type DataType = '' | 'MTD'; const HeaderFilterDomain = Remesh.domain({ name: 'HeaderFilterDomain', impl: (domain) => { const DataTypeState = domain.state<DataType>({ name: 'DataTypeState', default: '', }); const DataTypeQuery = domain.query({ name: 'DataTypeQuery', impl: ({ get }) => { return get(DataTypeState()); }, }); const UpdateDataTypeCommand = domain.command({ name: 'UpdateDataTypeCommand', impl: (_, type: DataType) => { return DataTypeState().new(type); }, }); return { query: { DataTypeQuery }, command: { UpdateDataTypeCommand }, event: {}, }; }, }); export default HeaderFilterDomain;
function TypeGridFilterCmp(props: IProps) { const { onClick } = props; const send = useRemeshSend(); const headerFilterDomain = useRemeshDomain(HeaderFilter()); const dataType = useRemeshQuery(headerFilterDomain.query.DataTypeQuery()); console.log('log: dataType', dataType); const updateDataType = (type: DataType) => { send(headerFilterDomain.command.UpdateDataTypeCommand(type)); }; return ( <div> <Grid columns={1} className="pick-type-grid"> <Grid.Item> <ul> <li className={dataType === '' ? 'active' : ''} onClick={() => { updateDataType(''); }} > 1 <div className="wait-select-icon" /> </li> <li className={dataType === '2' ? 'active' : ''} onClick={() => { updateDataType('MTD'); }} > 2 <div className="wait-select-icon" /> </li> </ul> </Grid.Item> </Grid> </div> ); }
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
Thank feedback. We will check it later:-)
@miser 这是由于只有这个组件订阅了那个 Query,因此一旦它卸载,就会被回收掉。
可以通过 RemeshScope组件来主动管理Query的保活范围,见文档
RemeshScope
No branches or pull requests
每次打开 TypeGridFilterCmp 组件,值都是 空 '', 请问为什么呀?
The text was updated successfully, but these errors were encountered: