  This study investigated the stability of Hamilton--Jacobi equation on general
metric spaces with a perturbation in some whole space. This type of stability
appears in the domain perturbation problem. We find that the stability holds
when the set converges in the Hausdorff sense and when the metric converges in
some uniform sense. Examples of the perturbed space satisfying these
assumptions include network approximation of self-similar sets such as the
Sierpi\'{n}ski gasket, junction of shrinking tubes, and lattice lines with the
Manhattan distance. We also give supplemental results on time-dependent or
noncompact case. Stability can be achieved when the class of test function of
metric viscosity solutions is reduced to the squared distance functions, whose
proof is also given.
