Skip to content
New issue

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

fix: not found. You need to call "Get.put https://github.com/jonataslaw/getx/issues/2944 #3102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

385841539
Copy link

#2944
"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"

#branch=dr/fix_not_found_viewController
#targetBranch=4ac2e3b Merge pull request #3095 from Aniketkhote/master

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

Every PR must update the corresponding documentation in the code, and also the readme in english with the following changes.

Pre-launch Checklist

  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or @jonataslaw said the PR is test-exempt.
  • All existing and new tests are passing.

jonataslaw#2944
"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"

#branch=dr/fix_not_found_viewController
#targetBranch=4ac2e3b Merge pull request jonataslaw#3095 from Aniketkhote/master
@wen14701083
Copy link

尝试了下这个方法,还是不行。delete方法会执行多次,第一次isDeleteByNextCreate状态被重置之后,第二次还是被删除了。导致还是出现问题。

@385841539
Copy link
Author

尝试了下这个方法,还是不行。delete方法会执行多次,第一次isDeleteByNextCreate状态被重置之后,第二次还是被删除了。导致还是出现问题。

第二次被删除 是符合预期的删除么 ? 如果不是符合预期的删除 那得看看 为何有不符合预期的删除了。

我这个fix 只是针对 , 反复快速创建 controller , 销毁速度赶不上创建速度导致的找不到的问题。

可以说说你的使用场景,大家一起看看。

@wen14701083
Copy link

嗯,我这边的场景是这样的。A 界面存在按钮跳转到B 界面(且容易点击),在B界面返回后立马点击再次跳转到B界面。

  1. A ---跳转--> B;
  2. B ---点击返回 ---> A ---快速点击---> B

在B点击返回到A再立刻跳转回B时,由于B界面的Controller delete存在延时,B界面的Controller创建后又被销毁了,导致错误。

按找你的代码修改后,发现B返回A时delete被回调了多次,导致无效。

@385841539
Copy link
Author

嗯,我这边的场景是这样的。A 界面存在按钮跳转到B 界面(且容易点击),在B界面返回后立马点击再次跳转到B界面。

  1. A ---跳转--> B;
  2. B ---点击返回 ---> A ---快速点击---> B

在B点击返回到A再立刻跳转回B时,由于B界面的Controller delete存在延时,B界面的Controller创建后又被销毁了,导致错误。

按找你的代码修改后,发现B返回A时delete被回调了多次,导致无效。

可以加v 13023222737 视频看看 。

  1. 核心是在 create的时候 , 我这边做了一次 判断,内存中有的话 强制执行delete操作,并且标记为isDeleteByNextCreate ,
  2. 生命周期执行 delete 的时候 , 判断 isDeleteByNextCreate 为true 则不执行删除 ,然后置为false

如果上面两点你都没问题,按照你的场景 有可能是 B创建的时候 ,内存里面还有 2个以上的 B 没走 Controller delete 流程 , 这种手动点击应该很难出现啊 , 要是写demo 代码倒是容易出现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants