Found a few bugs when loading via server side ajax
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- frontend
调研方向
从 StateRestore.ts 第 751-758 行以及 StateRestoreCollection.ts 第 641-647 行和第 878 行开始。使用链接的 ajax 示例复现刷新场景,检查已加载的状态是否可以更新,以及函数式 load callback 是否会触发。当从服务器加载的状态保留正确的预定义状态,并且文档中说明的更新行为在刷新后正常工作时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Have been having issues trying to get StateRestore to load all states via server side Ajax call
using the function style ajax calls per See Here to control all the server side saving
I have never seen if (data.action === 'load') option ever fire... so I resorted to using the ajax stateRestore option on initial load
as See Here
Everything works until browser refresh and then you can't update any of the existing based on this area in StateRestore.ts (line 751-758)
//If the state is predefined there is no need to save it over ajax or to local storage
if (this.s.isPreDefined) {
if (passedSuccessCallback) {
passedSuccessCallback.call(this);
}
return;
}
what occurs is all the states are set to isPreDefined: true even for ajax loading
There is also a typo in StateRestoreCollection.ts where you in line 641-647
currState.stateRestore = {
isPredefined: false,
state: id,
tableId: this.s.dt.table().node().id
};
It s/b isPreDefined not isPredefined
I looked at your source code and I don't ever see a callback for the load process, and all the function Ajax examples don't ever load server side.
Your above initialisation/ajax.html example fails the same way
Steps:
1: Load a new state and try all the options (Rename, Update, Remove) they all fire a callback to server
2: Keep at least one state and re-fresh browser.
3: You can do all options except Update (check and all the loaded states are now IsPreDefined)
In my case, I never have preDefined: in the DataTable settings... so I turned off the true condition in StateResotrCollection.ts
_addPreDefined (line 878)
So in closing,
A) is there a way to load via function call Ajax from the server or
B) you should change the _addPreDefined call to add a boolean to set that isPreDefined to false for Ajax loads
Thanks
- 主要语言
- JavaScript
- 星标
- 3
- 派生
- 2
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
status: waiting for maintainer
难度 2/5 1-3 小时 新手友好度 66/100
mui/material-ui#49511 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
mpetazzoni/sse.js#122 ·
-
[eslint-plugin] valid-styles rejects <progress> pseudo-elements (::-webkit-progress-bar, ::-webkit-progress-value, ::-moz-progress-bar)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
swc-project/swc-next#1022 ·
维护者通常 1 天内回复