[Solved]Any fix to the 1 frame glitch after starting a new game?

It seems MV has a minor glitch that after starting a new game, there is one visible frame in which the parallax is rendered before the actors and tiles become visible.
Usually this is not a problem when the background is black, but very noticeable if you use a parallax image.

This only happens when the new game option is chosen, regular map transfer and load saved game don't have this problem. Or at least the fadein hides the glitch pretty well.

Edit*
I know I can add a blank map to hide the issue, but is there a direct bug fix already?
You could try and use a fadein on the New Game command?
You could try and use a fadein on the New Game command?
Good point.

JavaScript:
DataManager.setupNewGame = function() {
    this.createGameObjects();
    this.selectSavefileForNewGame();
    $gameParty.setupStartingMembers();
    $gamePlayer.reserveTransfer($dataSystem.startMapId,
        $dataSystem.startX, $dataSystem.startY, undefined, 0); //default fadein
    Graphics.frameCount = 0;
};

So I added it in setupNewGame.
Now I have found a new problem.

It seems new game and load saved game has the same issue, after adding the fadein effect, there's still one frame that displays only the parallax, although the screen is dark enough, if you stare at it you can still see it.

A map to map transfer doesn't have this issue, as far as I can tell.
is the same issue around equal on transfer that I see a lot that a hud
is visible for a split second (once or twice) before it loads the map?

because if this is the same as loading a map, than it might be a little deeper.
Edit: Using MV

Not recommended - only for testing:
JavaScript:
Spriteset_Map.prototype.createParallax = function() {
    this._parallax = new TilingSprite();
    this._parallax.move(0, 0, Graphics.width, Graphics.height);
    setTimeout(()=>this._baseSprite.addChildAt(this._parallax, 1), 500);
};
The timing of when the TilingSprite is added vs when the Tilemap is added is about a half of a second (might differ with a different system). The parallax gets loaded first and is labeled as child 1 under the _baseSprite property.

I tested it with a setTimeout to get a feel for how long it needs to be in sync with when the Tilemap gets loaded and this was about the time that worked for my system to where it appeared to have both loaded at the same time.

Again, this is just to find out where the timing lies. I would create a listener for when the Tilemap gets loaded first and then run the create parallax function from there to see if it works better. I'll try it out later, I suppose.
Well it is a bit strange. I thought tilemap should be loaded in the loading screen. MZ doesn't seem to have this issue. Need to do some investigation.
Current quick fix:
Spoiler
JavaScript:
Spriteset_Map.prototype.createLowerLayer = function() {
    Spriteset_Base.prototype.createLowerLayer.call(this);
    // Comment out createParallax()
    // this.createParallax();
    this.createTilemap();
    this.createCharacters();
    this.createShadow();
    this.createDestination();
    this.createWeather();
};
Spriteset_Map.prototype.update = function() {
    Spriteset_Base.prototype.update.call(this);
    this.updateTileset();
    // Use update to check for timing of when tilemap is loaded
    // and if parallax is not loaded - create the parallax, otherwise,
    // update the current parallax
    if (this._tilemap && !this._parallax) {
        this.createParallax();
    } else {
        this.updateParallax();
    }
    this.updateTilemap();
    this.updateShadow();
    this.updateWeather();
};

Spriteset_Map.prototype.createParallax = function() {
    this._parallax = new TilingSprite();
    this._parallax.move(0, 0, Graphics.width, Graphics.height);
    // Add the child to be specifically at index 1 since we are changing the
    // way the child is added
    this._baseSprite.addChildAt(this._parallax, 1);
};

Test as needed and for errors. So far, both are loading at the same time now.

(Edit: tested it on a 70x70 map with a 3360x3360 png parallax. Both load at the same time).
I think I've narrowed down the problem to ShaderTilemap class.
For some reason it needs 1 extra frame to update its texture after the bitmap is loaded.

If I switch renderer mode to canvas everything seems fine. Only webgl has this problem.

Edit*
If a map is loaded, even if it doesn't have any tileset pictures, the bug is automatically fixed.
So this bug only happens when the first time you enter a map.
JavaScript:
(function(alias){
Scene_Map.prototype.isReady = function() {
  var ready = alias.apply(this,arguments);
 
  if(Graphics.isWebGL()){
    if(ready && !this._tilemapLoaded && this._spriteset){
      var renderer = Graphics._renderer;
      //first time? render a frame to warm up the tilemap renderer
      if(!renderer.plugins.tilemap.lastTimeCheck) renderer.render(this);
      this._tilemapLoaded = true;
    }
    return this._tilemapLoaded && ready;
  }
  return ready;
};
})(Scene_Map.prototype.isReady);

Well, this is my version of fix.
Basically, it lets the renderer render a frame when the scene is ready if tilemap is never used before.
Use Bitmap.snap could also work and maybe better because it doesn't render anything on the screen.
But this version has no visible side effects so I let it pass.

Original thread: https://forums.rpgmakerweb.com/threads/solved-any-fix-to-the-1-frame-glitch-after-starting-a-new-game.175140/